feat(#5): wire up auth0 on frontend #58
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
permissions: | |
actions: read | |
contents: read | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
outputs: | |
affected-projects: ${{ steps.record-affected-projects.outputs.affected-projects }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Dotenv | |
run: | | |
echo "${{ secrets.DOTENV_APP_WEB_DEV }}" > projects/app-web/.env.development.local | |
echo "${{ secrets.DOTENV_APP_WEB_E2E }}" > projects/app-web-e2e/.env | |
echo "${{ secrets.DOTENV_DB_POSTGRES }}" > projects/db-postgres/.env.production | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
cache: 'yarn' | |
- name: Install Dependencies | |
run: yarn install --immutable | |
- name: Capture SHA in NX Cloud | |
uses: nrwl/nx-set-shas@v4 | |
env: | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
- name: Track main branch | |
run: git branch --track main origin/main | |
if: ${{ github.event_name == 'pull_request' }} | |
- name: Check Formatting | |
run: yarn nx-cloud record -- nx format:check | |
env: | |
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} | |
- name: Lint | |
run: yarn nx affected -t lint | |
- name: Unit Tests | |
run: yarn nx affected -t test | |
- name: Build | |
run: yarn nx affected -t build | |
- name: Install E2E browsers | |
run: yarn dlx playwright install --with-deps | |
- name: E2E Tests | |
run: yarn nx affected -t e2e | |
- name: Upload Videos Of Failed E2E | |
uses: actions/upload-artifact@v4 | |
if: failure() | |
with: | |
name: playwright-results | |
path: projects/app-web-e2e/.test-results | |
- name: Record Affected Projects | |
id: record-affected-projects | |
if: ${{ github.ref_name == 'main' }} | |
run: | | |
delimiter="$(openssl rand -hex 8)" | |
echo "affected-projects<<${delimiter}" >> "${GITHUB_OUTPUT}" | |
yarn nx show projects --affected >> "${GITHUB_OUTPUT}" | |
echo "${delimiter}" >> "${GITHUB_OUTPUT}" | |
- name: Setup Fly CLI | |
if: ${{ github.ref_name == 'main' }} | |
uses: superfly/flyctl-actions/setup-flyctl@master | |
- name: Deploy Postgres Migrations | |
if: ${{ github.ref_name == 'main' && contains(steps.record-affected-projects.outputs.affected-projects, 'db-postgres') }} | |
run: yarn postgres:migrations-run:prod | |
- name: Deploy API Service | |
if: ${{ github.ref_name == 'main' && contains(steps.record-affected-projects.outputs.affected-projects, 'service-api') }} | |
run: yarn deploy:service-api --configuration=production | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: Deploy User Service | |
if: ${{ github.ref_name == 'main' && contains(steps.record-affected-projects.outputs.affected-projects, 'service-user') }} | |
run: yarn deploy:service-user --configuration=production | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} | |
- name: Deploy Web App | |
if: ${{ github.ref_name == 'main' && contains(steps.record-affected-projects.outputs.affected-projects, 'app-web') }} | |
run: yarn deploy:app-web --configuration=production | |
env: | |
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }} |