Deploy to a dokku server #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 a dokku server | |
on: | |
workflow_run: | |
workflows: [ Unit tests ] | |
branches: [ master ] | |
types: | |
- completed | |
workflow_dispatch: | |
jobs: | |
check-dokku: | |
name: Check if dokku secrets exist | |
runs-on: ubuntu-latest | |
environment: manga-tracker | |
outputs: | |
use_dokku: ${{ steps.setvar.outputs.use_dokku }} | |
steps: | |
- id: setvar | |
run: | | |
if [[ "${{ secrets.DOKKU_HOST }}" != "" ]]; \ | |
then | |
echo "Dokku host defined." | |
echo "::set-output name=use_dokku::true" | |
else | |
echo "Dokku host not defined" | |
echo "::set-output name=use_dokku::false" | |
fi | |
publish: | |
needs: [check-dokku] | |
if: (github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success') && needs.check-dokku.outputs.use_dokku == 'true' | |
name: Deploy | |
runs-on: ubuntu-latest | |
environment: | |
name: manga-tracker | |
url: https://manga.gachimuchi.men | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- id: deploy | |
name: Deploy to dokku | |
uses: idoberko2/dokku-deploy-github-action@v1 | |
with: | |
git-push-flags: --force | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
dokku-host: ${{ secrets.DOKKU_HOST }} | |
app-name: ${{ secrets.DOKKU_APP }} |