-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61203af
commit 32d5866
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 }} |