Merge pull request #398 from nelsonjchen/dependabot/docker/rust-1.71.1 #347
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
on: | |
# Trigger the workflow on push | |
# but only for the main branch | |
push: | |
branches: | |
- master | |
name: Continuous Deployment | |
concurrency: | |
group: "${{ github.ref }}-cd" | |
cancel-in-progress: true | |
jobs: | |
check-env: | |
runs-on: ubuntu-latest | |
outputs: | |
fly-api-token: ${{ steps.fly-api-token.outputs.defined }} | |
steps: | |
- id: fly-api-token | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
if: "${{ env.FLY_API_TOKEN != '' }}" | |
run: echo "defined=true" >> $GITHUB_OUTPUT | |
deploy: | |
needs: [check-env] | |
if: needs.check-env.outputs.fly-api-token == 'true' | |
name: Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: docker/setup-buildx-action@v2 | |
- uses: docker/build-push-action@v4 | |
with: | |
context: . | |
cache-from: type=gha,scope=cached-stage | |
cache-to: type=gha,scope=cached-stage,mode=max | |
load: true | |
tags: app:latest | |
- uses: superfly/flyctl-actions@1.4 | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
with: | |
args: "deploy --local-only -i app:latest" | |
- name: Cloudflare Cache Purge Action | |
uses: NathanVaughn/actions-cloudflare-purge@v3.0.0 | |
if: success() | |
with: | |
cf_zone: ${{ secrets.CLOUDFLARE_ZONE }} | |
cf_auth: ${{ secrets.CLOUDFLARE_AUTH_KEY }} |