|
| 1 | +# Sample workflow for building and deploying a Next.js site to GitHub Pages |
| 2 | +# |
| 3 | +# To get started with Next.js see: https://nextjs.org/docs/getting-started |
| 4 | +# |
| 5 | +name: Deploy Next.js site to Pages |
| 6 | + |
| 7 | +# TODO: Implement matrix for different node versions and next versions testing |
| 8 | + |
| 9 | +on: |
| 10 | + # Runs on pushes targeting the default branch |
| 11 | + push: |
| 12 | + branches: |
| 13 | + - main |
| 14 | + |
| 15 | + # Allows you to run this workflow manually from the Actions tab |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +env: |
| 19 | + working-directory: docs |
| 20 | + |
| 21 | +defaults: |
| 22 | + run: |
| 23 | + working-directory: docs |
| 24 | + |
| 25 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 26 | +permissions: |
| 27 | + contents: read |
| 28 | + pages: write |
| 29 | + id-token: write |
| 30 | + |
| 31 | +# Allow one concurrent deployment |
| 32 | +concurrency: |
| 33 | + group: 'pages' |
| 34 | + cancel-in-progress: true |
| 35 | + |
| 36 | +jobs: |
| 37 | + # Build job |
| 38 | + build: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + steps: |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@v3 |
| 43 | + - uses: oven-sh/setup-bun@v2 |
| 44 | + - name: Setup Pages |
| 45 | + uses: actions/configure-pages@v2 |
| 46 | + with: |
| 47 | + # Automatically inject basePath in your Next.js configuration file and disable |
| 48 | + # server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized). |
| 49 | + # |
| 50 | + # You may remove this line if you want to manage the configuration yourself. |
| 51 | + static_site_generator: next |
| 52 | + |
| 53 | + - name: Install dependencies |
| 54 | + run: bun install |
| 55 | + - name: Build with Next.js |
| 56 | + run: bun next build |
| 57 | + - name: Static HTML export with Next.js |
| 58 | + run: bun next export |
| 59 | + - name: Upload artifact |
| 60 | + uses: actions/upload-pages-artifact@v1 |
| 61 | + with: |
| 62 | + path: ./${{ env.working-directory }}/out |
| 63 | + |
| 64 | + # Deployment job |
| 65 | + deploy: |
| 66 | + environment: |
| 67 | + name: github-pages |
| 68 | + url: ${{ steps.deployment.outputs.page_url }} |
| 69 | + runs-on: ubuntu-latest |
| 70 | + needs: build |
| 71 | + steps: |
| 72 | + - name: Deploy to GitHub Pages |
| 73 | + id: deployment |
| 74 | + uses: actions/deploy-pages@v1 |
0 commit comments