1212jobs :
1313 build_and_deploy :
1414 runs-on : ubuntu-latest # Or macos-latest, windows-latest
15+ permissions : # <--- ADD THIS BLOCK
16+ contents : write # This grants write access to the repository contents
17+ pages : write # Grants permission to deploy to GitHub Pages (if configured)
18+ id-token : write # Required for OIDC, good practice
19+
1520
1621 steps :
1722 - name : Checkout Hugo Site Repository
@@ -33,24 +38,24 @@ jobs:
3338 # and add it as a repository secret named 'CONTENT_REPO_PAT'
3439 # GH_TOKEN: ${{ secrets.CONTENT_REPO_PAT }} # Uncomment if content repo is private
3540
36- # - name: Setup Hugo
37- # uses: peaceiris/actions-hugo@v3
38- # with:
39- # hugo-version: 'latest' # Or a specific version like '0.127.0'
40- # extended: true # Essential for SASS/SCSS and some advanced features
41-
42- # - name: Build Hugo Site
43- # # Add any custom build flags, e.g., baseURL if deploying to a subdirectory
44- # run: hugo --minify --baseURL "/" # Adjust baseURL if needed for your hosting
45-
46- # - name: Deploy to GitHub Pages (Example)
47- # # This step assumes you want to deploy to GitHub Pages
48- # # The 'public' directory will be pushed to the 'gh-pages' branch of THIS repo.
49- # uses: peaceiris/actions-gh-pages@v4
50- # if: github.ref == 'refs/heads/main' # Only deploy from main branch pushes
51- # with:
52- # github_token: ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub Actions
53- # publish_dir: ./public # Directory containing your built Hugo site
41+ - name : Setup Hugo
42+ uses : peaceiris/actions-hugo@v3
43+ with :
44+ hugo-version : ' latest' # Or a specific version like '0.127.0'
45+ extended : true # Essential for SASS/SCSS and some advanced features
46+
47+ - name : Build Hugo Site
48+ # Add any custom build flags, e.g., baseURL if deploying to a subdirectory
49+ run : hugo --minify --baseURL "/" # Adjust baseURL if needed for your hosting
50+
51+ - name : Deploy to GitHub Pages (Example)
52+ # This step assumes you want to deploy to GitHub Pages
53+ # The 'public' directory will be pushed to the 'gh-pages' branch of THIS repo.
54+ uses : peaceiris/actions-gh-pages@v4
55+ if : github.ref == 'refs/heads/main' # Only deploy from main branch pushes
56+ with :
57+ github_token : ${{ secrets.GITHUB_TOKEN }} # Automatically provided by GitHub Actions
58+ publish_dir : ./public # Directory containing your built Hugo site
5459 # This will create/update the 'gh-pages' branch for your site.
5560 # If your repo is `user/user.github.io`, it deploys to main branch.
5661 # cname: example.com # Uncomment and set if using a custom domain
0 commit comments