|
6 | 6 | - main
|
7 | 7 | paths:
|
8 | 8 | - 'docs/**'
|
| 9 | + - '.github/workflows/docs.yml' |
| 10 | + tags: ["v[0-9]+.[0-9]+.[0-9]+-docs"] |
9 | 11 | pull_request:
|
10 | 12 | branches:
|
11 | 13 | - main
|
|
18 | 20 | jobs:
|
19 | 21 | deploy:
|
20 | 22 | name: Deploy to GitHub Pages
|
| 23 | + env: |
| 24 | + CLOUDFLARE_ACCOUNT_ID: 9707100ef42a1a25bd70e3ee2137bd0e |
| 25 | + CLOUDFLARE_PROJECT_NAME: nitro |
21 | 26 | runs-on: ubuntu-latest
|
22 | 27 | steps:
|
23 | 28 | - uses: actions/checkout@v3
|
@@ -50,15 +55,33 @@ jobs:
|
50 | 55 | - name: Build website
|
51 | 56 | run: sed -i '/process.env.DEBUG = namespaces;/c\// process.env.DEBUG = namespaces;' ./node_modules/debug/src/node.js && yarn build
|
52 | 57 | working-directory: docs
|
53 |
| - |
| 58 | + |
| 59 | + - name: Publish to Cloudflare Pages PR Preview and Staging |
| 60 | + if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || (github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main') |
| 61 | + uses: cloudflare/pages-action@v1 |
| 62 | + with: |
| 63 | + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} |
| 64 | + accountId: ${{ env.CLOUDFLARE_ACCOUNT_ID }} |
| 65 | + projectName: ${{ env.CLOUDFLARE_PROJECT_NAME }} |
| 66 | + directory: ./docs/build |
| 67 | + # Optional: Enable this if you want to have GitHub Deployments triggered |
| 68 | + gitHubToken: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + id: deployCloudflarePages |
| 70 | + |
| 71 | + - uses: mshick/add-pr-comment@v2 |
| 72 | + if: github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' |
| 73 | + with: |
| 74 | + message: | |
| 75 | + Preview URL: ${{ steps.deployCloudflarePages.outputs.url }} |
| 76 | +
|
54 | 77 | - name: Add Custome Domain file
|
55 |
| - if: github.event_name == 'push' && github.event.pull_request.head.repo.full_name != github.repository |
| 78 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') |
56 | 79 | run: echo "${{ vars.DOCUSAURUS_DOMAIN }}" > ./docs/build/CNAME
|
57 | 80 |
|
58 | 81 | # Popular action to deploy to GitHub Pages:
|
59 | 82 | # Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
|
60 | 83 | - name: Deploy to GitHub Pages
|
61 |
| - if: github.event_name == 'push' && github.event.pull_request.head.repo.full_name != github.repository |
| 84 | + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') |
62 | 85 | uses: peaceiris/actions-gh-pages@v3
|
63 | 86 | with:
|
64 | 87 | github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
0 commit comments