Skip to content

chore(web): migrate to app router #210

chore(web): migrate to app router

chore(web): migrate to app router #210

Workflow file for this run

name: Build and preview the project
on:
pull_request:
branches: [ main ]
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
concurrency:
group: "${{ github.workflow }}-${{ github.head_ref || github.run_id }}"
cancel-in-progress: true
jobs:
build:
runs-on: ubuntu-latest
# Defined in .github/workflows/build-release.yml at the "Create Release Pull Request" step
if: ${{ github.event.pull_request.title != 'update release versions' }}
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/install-dependencies
- name: Start MySQL database
run: yarn workspace @snipcode/domain db:test
- name: Lint the projects
run: yarn lint
- name: Build the projects
env:
NEXT_PUBLIC_APP_URL: http://localhost:7500 # Required for the frontend build
run: yarn build
- name: Run tests
run: yarn test -- --coverage
should-preview-frontend:
runs-on: ubuntu-latest
needs:
- build
outputs:
frontendChanged: ${{ steps.frontend-changed.outputs.any_changed }}
steps:
- uses: actions/checkout@v4
- name: Check if frontend files changed
id: frontend-changed
uses: tj-actions/changed-files@v44
with:
files: |
apps/web/**
packages/front/**
preview-frontend:
runs-on: ubuntu-latest
environment: 'Preview'
needs:
- should-preview-frontend
if: ${{ needs.should-preview-frontend.outputs.frontendChanged == 'true' }}
steps:
- uses: actions/checkout@v4
- name: Install Yarn 4
run: |
corepack enable
yarn set version 4.3.1
- name: Install Vercel CLI
run: npm install --global vercel@latest
- name: Generate Application Version
run: |
RELEASE_VERSION="${{ github.head_ref }}-$(git rev-parse --short ${{ github.sha }})"
echo "APP_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
- name: Pull Vercel Environment Information
run: vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }}
- name: Build Project Artifacts
env:
SENTRY_RELEASE: ${{ env.APP_VERSION }}
run: vercel build --token=${{ secrets.VERCEL_TOKEN }}
- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --token=${{ secrets.VERCEL_TOKEN }}