FEAT: Deployment status (#25) #9
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 Fly | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
name: Deploy app | |
runs-on: ubuntu-latest | |
concurrency: deploy-group | |
steps: | |
- name: Checkout ποΈ | |
uses: actions/checkout@v4 | |
- name: Setup Fly π§° | |
uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Create GitHub Deployment π | |
id: create_deployment | |
uses: octokit/request-action@v2.3.1 | |
with: | |
route: POST /repos/${{ github.repository }}/deployments | |
environment: production | |
ref: ${{ github.sha }} | |
description: "Deploying to Fly.io" | |
auto_merge: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} | |
- name: Deploy to Fly.io π©οΈ | |
run: flyctl deploy --remote-only | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_TOKEN }} | |
- name: Set deployment status to success β | |
if: success() | |
uses: octokit/request-action@v2.3.1 | |
with: | |
route: POST /repos/${{ github.repository }}/deployments/${{ steps.create_deployment.outputs.id }}/statuses | |
state: success | |
description: "β Deployment Succeeded π₯³" | |
environment: production | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} | |
- name: Set deployment status to failure β | |
if: failure() | |
uses: octokit/request-action@v2.3.1 | |
with: | |
route: POST /repos/${{ github.repository }}/deployments/${{ steps.create_deployment.outputs.id }}/statuses | |
state: failure | |
description: "β Deployment Failed π₯" | |
environment: production | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN || secrets.GITHUB_TOKEN }} |