Skip to content

Commit ff3fea6

Browse files
committed
fix(ci): update GitHub Pages deployment to use newer actions and permissions
- Add explicit permissions for GitHub Pages deployment: - contents: read - for repository access - pages: write - for Pages deployment - id-token: write - for secure authentication - Replace deprecated peaceiris/actions-gh-pages with modern GitHub Actions: - actions/configure-pages@v4 for Pages setup - actions/upload-pages-artifact@v3 for artifact upload - actions/deploy-pages@v4 for deployment - Add github-pages environment configuration for proper deployment tracking This resolves the "Permission denied" error when deploying documentation to GitHub Pages. The new approach uses GitHub's built-in authentication instead of requiring manual token configuration. Fixes: remote: Permission to OpenPRoT/openprot.git denied to github-actions[bot]
1 parent 91dd4d8 commit ff3fea6

File tree

1 file changed

+20
-5
lines changed

1 file changed

+20
-5
lines changed

.github/workflows/docs.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@ on:
88
pull_request:
99
branches: [ main ]
1010

11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
1116
env:
1217
CARGO_TERM_COLOR: always
1318

1419
jobs:
1520
docs:
1621
name: Documentation
1722
runs-on: ubuntu-latest
23+
environment:
24+
name: github-pages
25+
url: ${{ steps.deployment.outputs.page_url }}
1826
steps:
1927
- uses: actions/checkout@v4
2028

@@ -41,10 +49,17 @@ jobs:
4149
cargo deadlinks --check-http
4250
continue-on-error: true
4351

44-
- name: Deploy documentation to GitHub Pages
52+
- name: Setup Pages
53+
if: github.ref == 'refs/heads/main'
54+
uses: actions/configure-pages@v4
55+
56+
- name: Upload artifact
4557
if: github.ref == 'refs/heads/main'
46-
uses: peaceiris/actions-gh-pages@v3
58+
uses: actions/upload-pages-artifact@v3
4759
with:
48-
github_token: ${{ secrets.GITHUB_TOKEN }}
49-
publish_dir: ./target/doc
50-
force_orphan: true
60+
path: ./target/doc
61+
62+
- name: Deploy to GitHub Pages
63+
if: github.ref == 'refs/heads/main'
64+
id: deployment
65+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)