|
1 |
| -name: Deploy Docusaurus to GitHub Pages |
| 1 | +name: Deploy to GitHub Pages |
2 | 2 |
|
3 | 3 | on:
|
4 | 4 | push:
|
5 | 5 | branches:
|
6 | 6 | - main
|
7 |
| - |
8 |
| -permissions: |
9 |
| - contents: write # Grants GitHub Actions write access to the repo |
10 |
| - pages: write |
11 |
| - id-token: write |
| 7 | + # Optional: Define triggers, paths, etc. |
| 8 | + # See: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on |
12 | 9 |
|
13 | 10 | jobs:
|
14 |
| - deploy: |
| 11 | + build: |
| 12 | + name: Build Docusaurus |
15 | 13 | runs-on: ubuntu-latest
|
16 | 14 | steps:
|
17 |
| - - name: Checkout code |
18 |
| - uses: actions/checkout@v4 |
| 15 | + - uses: actions/checkout@v4 |
19 | 16 | with:
|
20 |
| - persist-credentials: false # Prevents SSH key issues |
| 17 | + fetch-depth: 0 # Ensures full history for proper deployments |
21 | 18 |
|
22 |
| - - name: Set up Node.js |
23 |
| - uses: actions/setup-node@v4 |
| 19 | + - uses: actions/setup-node@v4 |
24 | 20 | with:
|
25 | 21 | node-version: 18
|
26 |
| - cache: 'yarn' |
| 22 | + cache: yarn |
27 | 23 |
|
28 | 24 | - name: Install dependencies
|
29 | 25 | run: yarn install --frozen-lockfile
|
30 | 26 |
|
31 |
| - - name: Build Docusaurus site |
| 27 | + - name: Build website |
32 | 28 | run: yarn build
|
33 | 29 |
|
| 30 | + - name: Upload Build Artifact |
| 31 | + uses: actions/upload-pages-artifact@v3 |
| 32 | + with: |
| 33 | + path: build # Upload the generated static site for deployment |
| 34 | + |
| 35 | + deploy: |
| 36 | + name: Deploy to GitHub Pages |
| 37 | + needs: build |
| 38 | + |
| 39 | + # Grant GITHUB_TOKEN the permissions required to make a Pages deployment |
| 40 | + permissions: |
| 41 | + pages: write # Allows deployment to GitHub Pages |
| 42 | + id-token: write # Verifies the deployment originates from an appropriate source |
| 43 | + |
| 44 | + # Deploy to the GitHub Pages environment |
| 45 | + environment: |
| 46 | + name: github-pages |
| 47 | + url: ${{ steps.deployment.outputs.page_url }} |
| 48 | + |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
34 | 51 | - name: Deploy to GitHub Pages
|
35 |
| - env: |
36 |
| - GIT_USER: github-actions[bot] |
37 |
| - USE_SSH: false |
38 |
| - GIT_URL: https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/blacksky-algorithms/blacksky-algorithms.github.io.git |
39 |
| - run: | |
40 |
| - git config --global user.name "github-actions[bot]" |
41 |
| - git config --global user.email "github-actions[bot]@users.noreply.github.com" |
42 |
| - git remote set-url origin $GIT_URL |
43 |
| - yarn deploy |
| 52 | + id: deployment |
| 53 | + uses: actions/deploy-pages@v4 |
0 commit comments