-
Notifications
You must be signed in to change notification settings - Fork 45
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 #77 from brian-rose/preview-madness
Post preview link AFTER the deployment to gh-pages
- Loading branch information
Showing
4 changed files
with
41 additions
and
9 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: delete-preview | ||
|
||
# Only run this when the main branch changes | ||
on: | ||
pull_request_target: | ||
types: closed | ||
|
||
jobs: | ||
delete: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
steps: | ||
# Find the PR associated with this push, if there is one. | ||
- uses: jwalton/gh-find-current-pr@v1 | ||
id: findPr | ||
with: | ||
# Can be "open", "closed", or "all". Defaults to "open". | ||
state: all | ||
# This will echo "Your PR is 7", or be skipped if there is no current PR. | ||
- run: echo "Your PR is ${PR}" | ||
if: success() && steps.findPr.outputs.number | ||
env: | ||
PR: ${{ steps.findPr.outputs.pr }} | ||
- name: Checkout gh-pages branch | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: gh-pages | ||
- name: Delete preview files | ||
run: | | ||
rm -rf _preview/${{ steps.findPr.outputs.pr }} | ||
- name: Commit the changes | ||
uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
branch: gh-pages | ||
commit_message: Delete preview for pull request \#${{ steps.findPr.outputs.pr }} |
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 |
---|---|---|
|
@@ -63,15 +63,6 @@ jobs: | |
if: ${{ steps.findPr.outputs.pr }} != '' | ||
run: rm -rf _preview/${{ steps.findPr.outputs.pr }} | ||
|
||
- name: Delete preview | ||
if: ${{ steps.findPr.outputs.pr }} != '' | ||
uses: peaceiris/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: _preview/${{ steps.findPr.outputs.pr }} | ||
enable_jekyll: false | ||
destination_dir: _preview/${{ steps.findPr.outputs.pr }} | ||
|
||
# Push the book's HTML to github-pages | ||
- name: Deploy to GitHub pages | ||
if: github.ref == 'refs/heads/main' | ||
|
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