|
| 1 | +name: Deploy Next.js site to Pages |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + pages: write |
| 11 | + id-token: write |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: "pages" |
| 15 | + cancel-in-progress: false |
| 16 | + |
| 17 | +jobs: |
| 18 | + build: |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v4 |
| 23 | + |
| 24 | + - name: Setup Node |
| 25 | + uses: actions/setup-node@v4 |
| 26 | + with: |
| 27 | + node-version: "20" |
| 28 | + |
| 29 | + - name: Enable Corepack |
| 30 | + run: corepack enable |
| 31 | + |
| 32 | + - name: Use Specific Yarn Version |
| 33 | + run: corepack prepare [email protected] --activate |
| 34 | + |
| 35 | + - name: Setup Pages |
| 36 | + uses: actions/configure-pages@v5 |
| 37 | + with: |
| 38 | + static_site_generator: next |
| 39 | + |
| 40 | + - name: Restore cache |
| 41 | + uses: actions/cache@v4 |
| 42 | + with: |
| 43 | + path: frontend/.next/cache |
| 44 | + key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} |
| 45 | + restore-keys: | |
| 46 | + ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json', '**/yarn.lock') }}- |
| 47 | +
|
| 48 | + - name: Install dependencies |
| 49 | + run: cd frontend && yarn install |
| 50 | + |
| 51 | + - name: Build with Next.js |
| 52 | + env: |
| 53 | + NEXT_PUBLIC_SUPABASE_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_URL }} |
| 54 | + NEXT_PUBLIC_SUPABASE_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_ANON_KEY }} |
| 55 | + NEXT_PUBLIC_SUPABASE_TEST_URL: ${{ secrets.NEXT_PUBLIC_SUPABASE_TEST_URL }} |
| 56 | + NEXT_PUBLIC_SUPABASE_TEST_ANON_KEY: ${{ secrets.NEXT_PUBLIC_SUPABASE_TEST_ANON_KEY }} |
| 57 | + run: cd frontend && yarn next build |
| 58 | + |
| 59 | + - name: Upload artifact |
| 60 | + uses: actions/upload-pages-artifact@v3 |
| 61 | + with: |
| 62 | + path: frontend/dist |
| 63 | + |
| 64 | + deploy: |
| 65 | + environment: |
| 66 | + name: github-pages |
| 67 | + url: ${{ steps.deployment.outputs.page_url }} |
| 68 | + runs-on: ubuntu-latest |
| 69 | + needs: build |
| 70 | + steps: |
| 71 | + - name: Deploy to GitHub Pages |
| 72 | + id: deployment |
| 73 | + uses: actions/deploy-pages@v4 |
0 commit comments