Skip to content

Prettier

Prettier #6

name: Fly Deploy PRODUCTION
on:
workflow_dispatch:
push:
branches:
- main
jobs:
deploy:
name: Deploy API
runs-on: ubuntu-latest
environment: api
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Fail if branch is not main
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main'
run: |
echo "This workflow should not be triggered with workflow_dispatch on a branch other than main"
exit 1
- name: Create GitHub deployment
uses: chrnorm/deployment-action@v2
id: deployment
with:
token: "${{ github.token }}"
environment-url: https://api.devfaq.pl
environment: api
- name: Prepare flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy to fly.io
run: flyctl deploy --config apps/api/fly.production.toml --remote-only -e GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) -e GIT_COMMIT_HASH=$(git rev-parse HEAD)
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
- name: Update deployment status (success)
if: success()
uses: chrnorm/deployment-status@v2
with:
token: "${{ github.token }}"
environment-url: ${{ steps.deployment.outputs.environment_url }}
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
state: "success"
- name: Update deployment status (failure)
if: failure()
uses: chrnorm/deployment-status@v2
with:
token: "${{ github.token }}"
environment-url: ${{ steps.deployment.outputs.environment_url }}
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
state: "failure"