we have a GitHub action which is below, setup to run the deployment step for a release. However whenever we create a release it creates 3 GitHub actions jobs rather than one. I’m not clear if it’s a GitHub bug or incorrect logic in the GitHub action (most likely)
name: Trigger auto deployment
# When this action will be executed
on:
# Automatically trigger it when detected changes in repo
push:
branches:
- main
# Allow manual trigger
workflow_dispatch:
pull_request:
types: ["opened", "edited", "reopened", "synchronize", "ready_for_review"]
jobs:
fail_if_pull_request_is_draft:
if: github.event.pull_request.draft == true
runs-on: ubuntu-latest
steps:
- name: Fails in order to indicate that pull request needs to be marked as ready to review
run: exit 1
ci:
name: 🫠 Build, lint, test
runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
timeout-minutes: 30
services:
edgedb:
image: edgedb/edgedb:4
env:
EDGEDB_SERVER_SECURITY: insecure_dev_mode
ports:
- 5656:5656
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: ./package-lock.json
node-version: 18
- name: 📥 Install deps
run: npm ci
# We can lint before installing EdgeDB, so do that first to fail fast
- name: 🔬 Lint
run: npm run lint
- name: 💿 Install EdgeDB
uses: edgedb/setup-edgedb@v1
with:
server-dsn: edgedb://localhost:5656
instance-name: ci_edgedb_instance
- name: Test edgedb query
run: edgedb query "SELECT 'Hello from GitHub Actions'"
# Don't need migration as setup above does it
- name: 👾 Generate EdgeQL client
run: npm run db:migrate
- name: 🔎 Type check
run: npm run typecheck
- name: 🏄 Copy test env vars
run: cp .env.example .en
- name: 🌱 Seed the database
run: npm run seed
- name: 🏗️ Build the server
run: npm run build
- name: 🌳 Cypress run
uses: cypress-io/github-action@v6
with:
start: npm run start
wait-on: "http://localhost:5173"
record: true
env:
PORT: "5173"
# pass GitHub token to detect new build vs re-run build
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# overwrite commit message sent to Cypress Cloud
COMMIT_INFO_MESSAGE: ${{github.event.pull_request.title}}
# re-enable PR comment bot
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha}}
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY
# in GitHub repo → Settings → Secrets → Actions
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
- name: Archive screenshots
if: failure()
uses: actions/upload-artifact@v4
with:
name: screenshots
path: ./cypress/screenshots
- name: Archive videos
if: always()
uses: actions/upload-artifact@v4
with:
name: cypress-videos
path: ./cypress/videos
build-and-deploy:
name: 🏗️ build and deploy
runs-on: ubuntu-latest
if: startsWith( github.ref, 'refs/tags/')
timeout-minutes: 30
environment: AXPEnv
permissions:
id-token: write
contents: read
services:
edgedb:
image: edgedb/edgedb:4
env:
EDGEDB_SERVER_SECURITY: insecure_dev_mode
ports:
- 5656:5656
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
- name: ⎔ Setup node
uses: actions/setup-node@v4
with:
cache: npm
cache-dependency-path: ./package-lock.json
node-version: 18
- name: 💿 Install EdgeDB
uses: edgedb/setup-edgedb@v1
with:
server-dsn: edgedb://localhost:5656
instance-name: ci_edgedb_instance
- name: ✈️ Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 🤨 Querybuilder
run: npm run db:migrate
- name: Build and push container image to registry
uses: azure/container-apps-deploy-action@v2
with:
registryUrl: axpreg.azurecr.io
registryUsername: ${{ secrets.REGISTRY_USERNAME }}
registryPassword: ${{ secrets.REGISTRY_PASSWORD }}
containerAppName: someapp
resourceGroup: somegroup
appSourcePath: ${{ github.workspace }}
imageToBuild: axpreg.azurecr.io/someapp:${{ github.ref_name }}
environmentVariables: "..."