fix: add subpage open graph metadata (#846) #426
This file contains hidden or 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
| # Deploy to GitHub Pages | |
| name: Deploy to GitHub Pages | |
| on: | |
| # Runs on pushes targeting the main branch | |
| push: | |
| branches: ["main"] | |
| # Allows manual deployment from Actions tab | |
| workflow_dispatch: | |
| # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Allow only one concurrent deployment | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| # Build job | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| environment: github-pages | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history for proper git info | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: ".nvmrc" | |
| cache: "npm" | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| with: | |
| # Automatically inject basePath in Next.js config | |
| static_site_generator: next | |
| - name: Cache dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.npm | |
| node_modules | |
| .next/cache | |
| key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}- | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build with Next.js | |
| run: npm run build | |
| env: | |
| NODE_ENV: production | |
| # Use environment variable for GA tracking ID | |
| NEXT_PUBLIC_GA_TRACKING_ID: ${{ vars.NEXT_PUBLIC_GA_TRACKING_ID }} | |
| - name: Verify build output | |
| run: | | |
| if [ ! -d "out" ]; then | |
| echo "Error: 'out' directory not found. Static export failed." | |
| exit 1 | |
| fi | |
| echo "Build successful. Generated $(find out -type f | wc -l) files." | |
| du -sh out/ | |
| - name: Ensure .nojekyll exists in output | |
| run: | | |
| if [ ! -f "out/.nojekyll" ]; then | |
| cp public/.nojekyll out/.nojekyll || touch out/.nojekyll | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./out | |
| # Deployment job | |
| deploy: | |
| name: Deploy | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |