|
6 | 6 | paths: |
7 | 7 | - 'docs/**' |
8 | 8 | - '.github/workflows/bookdown.yaml' |
| 9 | + pull_request: |
| 10 | + branches: [main, master] |
| 11 | + paths: |
| 12 | + - 'docs/**' |
| 13 | + - '.github/workflows/bookdown.yaml' |
9 | 14 | workflow_dispatch: |
| 15 | + inputs: |
| 16 | + publish: |
| 17 | + description: 'publish the book to github pages for connect cloud deployment' |
| 18 | + required: false |
| 19 | + default: false |
| 20 | + type: boolean |
10 | 21 |
|
11 | 22 | name: Build and deploy book |
12 | 23 |
|
@@ -51,28 +62,18 @@ jobs: |
51 | 62 | key: bookdown-1-${{ hashFiles('docs/*Rmd') }} |
52 | 63 | restore-keys: bookdown-1- |
53 | 64 |
|
54 | | - - name: Build and Deploy all book |
55 | | - if: github.event_name == 'push' |
56 | | - env: |
57 | | - CONNECT_API_KEY: ${{ secrets.RSC_BOOKDOWN_ORG_TOKEN }} |
58 | | - CONTENT_ID: 463 |
| 65 | + - name: Build all book |
59 | 66 | run: make -C docs all |
60 | 67 |
|
61 | | - - uses: actions/github-script@v3 |
62 | | - env: |
63 | | - URL: https://bookdown.org/yihui/blogdown |
| 68 | + - name: Deploy Gitbook to gh-pages |
| 69 | + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' |
| 70 | + uses: JamesIves/github-pages-deploy-action@v4 |
64 | 71 | with: |
65 | | - github-token: ${{secrets.GITHUB_TOKEN}} |
66 | | - script: | |
67 | | - github.repos.createCommitStatus({ |
68 | | - owner: context.repo.owner, |
69 | | - repo: context.repo.repo, |
70 | | - sha: context.sha, |
71 | | - state: "success", |
72 | | - target_url: "${{ env.URL}}", |
73 | | - description: "Book deployed!", |
74 | | - context: "bookdown.org" |
75 | | - }) |
| 72 | + branch: gh-pages |
| 73 | + folder: docs/_book |
| 74 | + clean: true |
| 75 | + single-commit: true |
| 76 | + dry-run: ${{ (github.event_name == 'workflow_dispatch' && (github.event.inputs.publish == 'false' || github.event.inputs.publish == false)) || false }} |
76 | 77 |
|
77 | 78 | - name: Upload book folder for debug |
78 | 79 | if: failure() |
|
0 commit comments