forked from dipy/dipy.org
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
36 additions
and
31 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 |
---|---|---|
|
@@ -4,8 +4,6 @@ on: | |
workflow_run: | ||
workflows: ["Github Pages"] | ||
types: [completed] | ||
pull_request_target: | ||
types: [closed] | ||
|
||
jobs: | ||
get-pr-number: | ||
|
@@ -86,32 +84,3 @@ jobs: | |
number: ${{ needs.get-pr-number.outputs.output1 }} | ||
id: deploy-preview | ||
message: "A preview of ${{ github.event.workflow_run.head_commit.message }} is uploaded and can be seen here:\n\n ✨ ${{ env.BASE_URL }}/${{ env.PR_PATH }} ✨\n\nChanges may take a few minutes to propagate. The source is here: https://github.com/dipy/preview-html/tree/main/${{ env.PR_PATH }}/" | ||
on-closed: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.action == 'closed' }} | ||
env: | ||
PR_PATH: dipy.org/pull/${{github.event.number}} | ||
steps: | ||
- name: make empty dir | ||
run: mkdir public | ||
|
||
- name: delete folder | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
deploy_key: ${{ secrets.ACTIONS_DEPLOY_TOKEN }} | ||
publish_dir: ./public | ||
publish_branch: main | ||
destination_dir: ${{ env.PR_PATH }} | ||
user_name: 'github-actions[bot]' | ||
user_email: 'github-actions[bot]@users.noreply.github.com' | ||
commit_message: ${{ github.event.head_commit.message }} | ||
|
||
- name: Update PR Comment | ||
uses: hasura/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ github.event.number }} | ||
id: deploy-preview | ||
message: "🪓 PR closed, deleted preview at https://github.com/dipy/preview-html/tree/main/${{ env.PR_PATH }}/" | ||
|
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 |
---|---|---|
|
@@ -5,13 +5,19 @@ on: | |
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize, edited, reopened] | ||
branches: | ||
- master | ||
pull_request_target: | ||
types: [closed] | ||
branches: | ||
- master | ||
schedule: | ||
- cron: '0 0 * * 1' | ||
|
||
jobs: | ||
deploy: | ||
if: ${{ github.event.action != 'closed' }} | ||
runs-on: ubuntu-latest | ||
env: | ||
PR_PATH: dipy.org/pull/${{github.event.number}} | ||
|
@@ -23,12 +29,14 @@ jobs: | |
STATUS: ${{github.event.pull_request.head.repo.full_name != github.repository}} | ||
steps: | ||
- name: Save the PR number in an artifact | ||
if: ${{ github.event == 'pull_request' }} | ||
shell: bash | ||
env: | ||
PULL_REQUEST_NUMBER: ${{ github.event.number }} | ||
run: echo $PULL_REQUEST_NUMBER > pull_request_number.txt | ||
|
||
- name: Upload the PULL REQUEST number | ||
if: ${{ github.event == 'pull_request' }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: pull_request_number | ||
|
@@ -67,3 +75,31 @@ jobs: | |
user_email: 'github-actions[bot]@users.noreply.github.com' | ||
commit_message: ${{ github.event.head_commit.message }} | ||
# cname: ${{ env.DOMAIN # TODO: set this if you're using a custom domain. | ||
on-closed: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.action == 'closed' }} | ||
env: | ||
PR_PATH: dipy.org/pull/${{github.event.number}} | ||
steps: | ||
- name: make empty dir | ||
run: mkdir public | ||
|
||
- name: delete folder | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
deploy_key: ${{ secrets.ACTIONS_DEPLOY_TOKEN }} | ||
publish_dir: ./public | ||
publish_branch: main | ||
destination_dir: ${{ env.PR_PATH }} | ||
user_name: 'github-actions[bot]' | ||
user_email: 'github-actions[bot]@users.noreply.github.com' | ||
commit_message: ${{ github.event.head_commit.message }} | ||
|
||
- name: Update PR Comment | ||
uses: hasura/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ github.event.number }} | ||
id: deploy-preview | ||
message: "🪓 PR closed, deleted preview at https://github.com/dipy/preview-html/tree/main/${{ env.PR_PATH }}/" |