Skip to content

Commit

Permalink
Trigger fly deploy after successful completion of docker image build
Browse files Browse the repository at this point in the history
  • Loading branch information
aaalexlit committed Mar 3, 2024
1 parent 42107ec commit 9ac3c8b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
name: Fly Deploy

on:
workflow_run:
workflows: ["Docker Image CI"]
types:
- completed
workflow_dispatch:
inputs:
docker_tag:
description: 'Docker image tag to be deployed. by default `aaalexlit/faq-slack-bot:main`'
description: 'Docker image tag to be deployed. by default `main`'
required: false
default: 'main'

jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only --image aaalexlit/faq-slack-bot:${{ github.event.inputs.docker_tag }}
- run: |
if [ "${{ github.event_name }}" == "workflow_run" ]; then
DOCKER_TAG="main"
else
DOCKER_TAG="${{ github.event.workflow_run.event.inputs.docker_tag || github.event.inputs.docker_tag }}"
fi
flyctl deploy --remote-only --image aaalexlit/faq-slack-bot:${DOCKER_TAG}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

0 comments on commit 9ac3c8b

Please sign in to comment.