-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #542 from UBC-DSCI/workflow-improvements
Improved workflows
- Loading branch information
Showing
4 changed files
with
104 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Rebuild and deploy dev version of book to gh-pages branch in dev/ folder | ||
on: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'index.Rmd' | ||
- '_bookdown.yml' | ||
- '_output.yml' | ||
- 'source/*.Rmd' | ||
- 'source/*.bib' | ||
- 'source/*.css' | ||
- 'data/**' | ||
- 'img/**' | ||
|
||
jobs: | ||
deploy-main-preview: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: 'main' | ||
|
||
- name: Build the book | ||
run: | | ||
./build_html.sh | ||
# Push the book's HTML to github-pages | ||
- name: GitHub Pages action | ||
uses: peaceiris/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: docs/ | ||
keep_files: true | ||
destination_dir: dev | ||
# force_orphan: true # once peaceiris updates to v4, change this to true and keep_files: true for the PR / main branch deploy previews | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: "Rebuild and deploy PR version of book to gh-pages branch in pull###/ folder" | ||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
paths: | ||
- 'index.Rmd' | ||
- '_bookdown.yml' | ||
- '_output.yml' | ||
- 'source/*.Rmd' | ||
- 'source/*.bib' | ||
- 'source/*.css' | ||
- 'data/**' | ||
- 'img/**' | ||
|
||
jobs: | ||
deploy-pr-preview: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
packages: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Wait for potential build environment update | ||
uses: fountainhead/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
checkName: "Rebuild docker image" | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Checkout the repo | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
ref: ${{ github.head_ref }} | ||
|
||
- name: Build the book | ||
run: | | ||
./build_html.sh | ||
# Push the book's HTML to github-pages | ||
- name: GitHub Pages action | ||
uses: peaceiris/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: docs/ | ||
keep_files: true | ||
destination_dir: pull${{ github.event.number }} | ||
# force_orphan: true # once peaceiris updates to v4, change this to true and keep_files: true for the PR / main branch deploy previews | ||
|
||
- name: Post URLS to PR thread | ||
uses: mshick/[email protected] | ||
with: | ||
message: | | ||
Hello! I've built a preview of your PR so that you can compare it to the current `main` branch. | ||
* PR deploy preview available [here](https://datasciencebook.ca/pull${{ github.event.number }}/index.html) | ||
* Current `main` deploy preview available [here](https://datasciencebook.ca/dev/index.html) | ||
* Public production build available [here](https://datasciencebook.ca) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters