Skip to content

Commit 68bcafb

Browse files
Fix GitHub Pages deployment workflow
1 parent 4765da3 commit 68bcafb

File tree

1 file changed

+33
-16
lines changed

1 file changed

+33
-16
lines changed

.github/workflows/pages.yml

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,54 @@ on:
55
branches:
66
- main
77

8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment
15+
concurrency:
16+
group: "pages"
17+
cancel-in-progress: true
18+
819
jobs:
920
deploy:
1021
runs-on: ubuntu-latest
22+
environment:
23+
name: github-pages
24+
url: ${{ steps.deployment.outputs.page_url }}
25+
1126
steps:
1227
- name: Checkout
1328
uses: actions/checkout@v3
1429

15-
- name: Setup Node.js
16-
uses: actions/setup-node@v3
17-
with:
18-
node-version: '16'
19-
30+
- name: Setup Pages
31+
uses: actions/configure-pages@v4
32+
2033
- name: Create gh-pages structure
2134
run: |
2235
# Create the directory structure for GitHub Pages
2336
mkdir -p gh-pages
2437
2538
# Copy the DocC documentation to the root of the GitHub Pages site
26-
cp -r docs/* gh-pages/
39+
cp -r docs/* gh-pages/ || echo "No docs directory found"
2740
28-
# Copy our landing page as the index.html
29-
cp landing-page.html gh-pages/index.html
41+
# Copy our landing page as the index.html if it exists
42+
if [ -f "landing-page.html" ]; then
43+
cp landing-page.html gh-pages/index.html
44+
elif [ -f "index.html" ]; then
45+
cp index.html gh-pages/index.html
46+
fi
3047
31-
# Copy other necessary files
32-
cp -r assets gh-pages/ || true
48+
# Create .nojekyll file to disable Jekyll processing
3349
touch gh-pages/.nojekyll
3450
35-
- name: Deploy to GitHub Pages
36-
uses: peaceiris/actions-gh-pages@v3
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v3
3753
with:
38-
github_token: ${{ secrets.GITHUB_TOKEN }}
39-
publish_dir: ./gh-pages
40-
publish_branch: gh-pages
41-
force_orphan: true
54+
path: './gh-pages'
55+
56+
- name: Deploy to GitHub Pages
57+
id: deployment
58+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)