Files
Compass/.github/workflows/cd-api.yml
Okechi Jones-Williams b18a6d7ff3 [Onboarding Flow] Added database checks to the onboarding flow (#34)
* Fixed Type errors

* Organizing testing utilities

* Added Database checks to the onboarding flow

* Updated Onboarding flow
Changed type ChildrenExpectation so that it can be used for database verification

* Added compatibility page setup
Added more compatibility questions

* Fix

* .

* Fix: Typo

* Fix: Faker usernames can no longer generate symbols

* Fix: Changed how work area is verified

* .

* .

* Fix: Trying to work in headed mode

* Fix: Change back to headless

* Fix: Added timeout after workArea selection

* .

* Clean e2e

* Improve E2E setup

* Prettier

* Log

* Fix: should pull test account from unique identifier like email, username or id; not the display name

* Source env vars in playwright directly

* Clean e2e data

* Clean test account id to be the same for email and username

* Fix import warning

* Add error handling

* Add log

* Temp remove env load

* Update

* Add logs and safeguards against using remote supabase during e2e tests

* Fix playwright report path in C@

* Remove locale log

* Check if userInformationFromDb loading with name instead of username was the issue

* Remove login log

* Check if initial work area names were the issue

* Ignore if no files found

* Cache Firebase emulators in CI

* Reload env vars in playwright

* It did not break tests...

* Clean verifyWorkArea

* Add caching for node modules in CI

* Add caching for node modules in CI (2)

* Do not raise if emulator not running during db seed

* Do not raise if using firebase emulator

* Fix supabase cache in CI

* Add Cache Playwright browsers in CI

* Fix

* Test cache

* Turn off unused supabase services to speed things up

* Back to good one

* Set CI=true

* api is required for client connection

* Add safeguards for missing supabase env vars

* Remove echo

* Remove supabase cache

---------

Co-authored-by: Martin Braquet <martin.braquet@gmail.com>
2026-03-01 01:25:56 +01:00

96 lines
2.6 KiB
YAML

name: API Release
on:
push:
branches: [main, master]
paths:
- 'backend/api/package.json'
- '.github/workflows/cd-api.yml'
jobs:
check-version:
name: Check Version
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.check.outputs.changed }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Read current version
id: current
run: |
current=$(jq -r '.version' backend/api/package.json)
echo "version=$current" >> $GITHUB_OUTPUT
- name: Read previous version
id: previous
run: |
if git show HEAD^:backend/api/package.json >/dev/null 2>&1; then
previous=$(git show HEAD^:backend/api/package.json | jq -r '.version')
else
previous="none"
fi
echo "version=$previous" >> $GITHUB_OUTPUT
- name: Compare versions
id: check
run: |
echo "current=${{ steps.current.outputs.version }}"
echo "previous=${{ steps.previous.outputs.version }}"
if [ "${{ steps.current.outputs.version }}" = "${{ steps.previous.outputs.version }}" ]; then
echo "Version unchanged. Skipping deploy."
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: check-version
if: needs.check-version.outputs.changed == 'true'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install dependencies
run: yarn install
- name: Authenticate to GCP
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Install gcloud CLI
uses: google-github-actions/setup-gcloud@v2
with:
project_id: compass-130ba
- name: Configure Docker for Artifact Registry
run: gcloud auth configure-docker us-west1-docker.pkg.dev --quiet
- name: Install Tofu (Terraform)
run: |
LATEST=https://github.com/opentofu/opentofu/releases/download/v1.10.5/tofu_1.10.5_linux_amd64.zip
curl -LO "$LATEST"
unzip -o tofu_*_linux_amd64.zip
sudo mv tofu /usr/local/bin/
rm tofu_*_linux_amd64.zip
echo "OpenTofu version: $(tofu version)"
cd backend/api
tofu init
- name: Run deploy script
run: |
chmod +x backend/api/deploy-api.sh
backend/api/deploy-api.sh