name: Deploy Next.js site to Pages on: push: branches: ["main"] workflow_dispatch: permissions: contents: write pages: write id-token: write concurrency: group: "pages" cancel-in-progress: false jobs: build: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: "20" - name: Install dependencies and update package-lock.json run: | cd web npm install git config user.name github-actions git config user.email github-actions@github.com git add package-lock.json git commit -m "Update package-lock.json" || echo "No changes to commit" git push - name: Build Next.js project run: | cd web npm run build - name: Copy guides and changelog run: | mkdir -p web/out/guides cp guides/*.md web/out/guides/ cp CHANGELOG.md web/out/ - name: Upload artifact to GitHub Pages uses: actions/upload-pages-artifact@v3 with: path: web/out deploy: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest needs: build steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4