Deploy to Heroku #41
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Heroku | |
on: | |
workflow_dispatch: | |
workflow_run: | |
workflows: [ "CI" ] | |
branches: [ master ] | |
types: | |
- completed | |
jobs: | |
deploy: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'adopt' | |
cache: maven | |
- name: Deploy | |
env: | |
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
run: mvn -B clean heroku:deploy -DskipTests | |
scale: | |
needs: deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Sleep for 30 seconds | |
uses: whatnick/wait-action@master | |
with: | |
time: '30s' | |
- name: Scale worker | |
env: | |
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }} | |
run: heroku ps:scale worker=1 -a $HEROKU_APP_NAME |