Skip to content

Update cms to Payload 3 #515

Update cms to Payload 3

Update cms to Payload 3 #515

Workflow file for this run

name: Fly Deployment
# This workflow is triggered by a pull request or push to the main branch.
# Renovate and Nx migrations are ignored.
# It will deploy affected applications to Fly.io.
on:
pull_request:
types:
- opened
- closed
- reopened
- synchronize
push:
branches:
- main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
NX_NO_CLOUD: ${{ vars.NX_NO_CLOUD }}
permissions:
contents: write
pull-requests: write
concurrency:
group: ${{ github.ref }}
jobs:
deploy-env:
if: |
!startsWith(github.head_ref || github.ref_name, 'renovate') &&
!startsWith(github.head_ref || github.ref_name, 'update-nx-workspace')
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.environment.outputs.environment }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build action
run: pnpm nx build deploy-env-action
- name: Determine environment
id: environment
uses: ./packages/deploy-env-action
fly-deployment:
needs: deploy-env
runs-on: ubuntu-latest
# Not possible to provide url since we might have multiple deployments
environment: ${{ needs.deploy-env.outputs.environment }}
steps:
- uses: actions/create-github-app-token@v1
id: generate-token
with:
app-id: ${{ secrets.CDWR_ACTIONS_BOT_ID }}
private-key: ${{ secrets.CDWR_ACTIONS_BOT_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build action
run: pnpm nx build nx-fly-deployment-action
- name: Install Fly CLI
uses: superfly/flyctl-actions/setup-flyctl@master
with:
version: 0.3.45
- name: Analyze affected projects to deploy
uses: nrwl/nx-set-shas@v4
with:
main-branch-name: main
set-environment-variables-for-job: true
# TODO: Fetch all tenants and make a deployment for each with their `TENANT_ID`
# TODO: Alternatively, create a new input with multi-tenant values
- name: Run Deployment to Fly
id: deployment
uses: ./packages/nx-fly-deployment-action
with:
fly-api-token: ${{ secrets.FLY_API_TOKEN }}
fly-org: ${{ vars.FLY_ORG }}
fly-region: ${{ vars.FLY_REGION }}
token: ${{ steps.generate-token.outputs.token }}
env: |
TENANT_ID=demo
secrets: |
INFISICAL_CLIENT_ID=${{ secrets.INFISICAL_READ_CLIENT_ID }}
INFISICAL_CLIENT_SECRET=${{ secrets.INFISICAL_READ_CLIENT_SECRET }}
INFISICAL_PROJECT_ID=${{ secrets.INFISICAL_PROJECT_ID }}
opt-out-depot-builder: ${{ vars.FLY_OPT_OUT_DEPOT }}
env:
# Postgres preview cluster defined in `github.json`
POSTGRES_PREVIEW: ${{ vars.FLY_POSTGRES_PREVIEW }}