Skip to content

Commit

Permalink
Deploy every commit
Browse files Browse the repository at this point in the history
  • Loading branch information
thewilkybarkid committed Jun 19, 2024
1 parent 61203af commit 32d5866
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,69 @@ jobs:

- name: 'Run formatter'
run: npx prettier --ignore-unknown --check '**'

push:
name: 'Push image'
runs-on: ubuntu-22.04
timeout-minutes: 30
if: github.ref == 'refs/heads/main'
outputs:
image: ${{ steps.image.outputs.image }}
needs:
- build-image
- format

steps:
- name: 'Set up flyctl'
uses: superfly/flyctl-actions/[email protected]

- name: 'Log in to the registry'
run: flyctl auth docker
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

- name: 'Download image'
uses: actions/[email protected]
with:
name: image
path: /tmp

- name: 'Load image'
run: docker load --input /tmp/image.tar

- name: 'Generate image name'
id: image
run: echo "image=registry.fly.io/prereview-stats:${{ github.sha }}" >> $GITHUB_OUTPUT

- name: 'Tag image'
run: docker tag ${{ needs.build-image.outputs.image }} ${{ steps.image.outputs.image }}

- name: 'Push image'
run: docker push ${{ steps.image.outputs.image }}

deploy:
name: 'Deploy (${{ matrix.instance }})'
runs-on: ubuntu-22.04
timeout-minutes: 30
if: github.ref == 'refs/heads/main'
needs:
- push
strategy:
fail-fast: false
matrix:
instance: ['prod', 'sandbox']

steps:
- name: 'Checkout code'
uses: actions/[email protected]
with:
sparse-checkout: fly.toml
sparse-checkout-cone-mode: false

- name: 'Set up flyctl'
uses: superfly/flyctl-actions/[email protected]

- name: 'Deploy app'
run: flyctl deploy --image ${{ needs.push.outputs.image }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

0 comments on commit 32d5866

Please sign in to comment.