|
5 | 5 | branches: |
6 | 6 | - main |
7 | 7 |
|
| 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 | + |
8 | 19 | jobs: |
9 | 20 | deploy: |
10 | 21 | runs-on: ubuntu-latest |
| 22 | + environment: |
| 23 | + name: github-pages |
| 24 | + url: ${{ steps.deployment.outputs.page_url }} |
| 25 | + |
11 | 26 | steps: |
12 | 27 | - name: Checkout |
13 | 28 | uses: actions/checkout@v3 |
14 | 29 |
|
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 | + |
20 | 33 | - name: Create gh-pages structure |
21 | 34 | run: | |
22 | 35 | # Create the directory structure for GitHub Pages |
23 | 36 | mkdir -p gh-pages |
24 | 37 | |
25 | 38 | # 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" |
27 | 40 | |
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 |
30 | 47 | |
31 | | - # Copy other necessary files |
32 | | - cp -r assets gh-pages/ || true |
| 48 | + # Create .nojekyll file to disable Jekyll processing |
33 | 49 | touch gh-pages/.nojekyll |
34 | 50 | |
35 | | - - name: Deploy to GitHub Pages |
36 | | - uses: peaceiris/actions-gh-pages@v3 |
| 51 | + - name: Upload artifact |
| 52 | + uses: actions/upload-pages-artifact@v3 |
37 | 53 | 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