This file contains 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
# Simple workflow for deploying static content to GitHub Pages | |
name: Deploy static content to Pages | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: ["main"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
env: | |
FORCE_JAVASCRIPT_ACTIONS_TO_NODE20: true | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "npm" | |
- name: Install | |
run: npm ci | |
- name: Build and Render | |
shell: bash | |
run: | | |
npm run build | |
env: | |
NODE_ENV: production | |
NEXT_PUBLIC_GA_TRACKING_ID: G-M6H0YTT6ND # Google Analytics tracking ID | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- name: Fix permissions | |
run: | | |
chmod -v -R +rX "_site/" | while read line; do | |
echo "::warning title=Invalid file permissions automatically fixed::$line" | |
done | |
- name: Upload artifact | |
id: upload | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "out" # Ensure 'out' is the correct directory for your static files | |
name: github-pages # Artifact name | |
deploy: | |
# Add a dependency to the build job | |
needs: build | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action | |
with: | |
artifact_name: github-pages |