-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/team
- Loading branch information
Showing
7 changed files
with
202 additions
and
133 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,86 @@ | ||
name: HTML Preview | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Github Pages"] | ||
types: [completed] | ||
|
||
jobs: | ||
get-pr-number: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.event == 'pull_request' }} | ||
outputs: | ||
output1: ${{ steps.echo_pr_nb.outputs.pr_number }} | ||
steps: | ||
- name: Download workflow artifact | ||
uses: dawidd6/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
workflow: publish.yml | ||
run_id: ${{ github.event.workflow_run.id }} | ||
- name: Read the pull_request_number.txt file | ||
id: pull_request_number_reader | ||
uses: juliangruber/[email protected] | ||
with: | ||
path: ./pull_request_number/pull_request_number.txt | ||
- name: Echo pull_request_number | ||
id: echo_pr_nb | ||
run: echo "pr_number=${{ steps.pull_request_number_reader.outputs.content }}" >> $GITHUB_OUTPUT | ||
|
||
on-failure: | ||
runs-on: ubuntu-latest | ||
needs: get-pr-number | ||
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure' }} | ||
steps: | ||
- name: 'Comment on PR - Waiting for deployment' | ||
uses: hasura/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ needs.get-pr-number.outputs.output1 }} | ||
id: deploy-preview | ||
message: "⚠️⚠️⚠️ Build Failed: No preview available." | ||
|
||
on-success: | ||
runs-on: ubuntu-latest | ||
needs: get-pr-number | ||
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} | ||
env: | ||
PR_PATH: dipy.org/pull/${{needs.get-pr-number.outputs.output1}} | ||
BASE_URL: https://dipy.github.io/preview-html | ||
steps: | ||
- name: 'Comment on PR - Waiting for deployment' | ||
uses: hasura/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ needs.get-pr-number.outputs.output1 }} | ||
id: deploy-preview | ||
message: "Starting deployment of preview ⏳..." | ||
- name: Download workflow artifact | ||
uses: dawidd6/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
workflow: publish.yml | ||
run_id: ${{ github.event.workflow_run.id }} | ||
name: DocumentationHTML | ||
path: ./DocumentationHTML | ||
- name: Deploy to PR preview | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
deploy_key: ${{ secrets.ACTIONS_DEPLOY_TOKEN }} | ||
external_repository: dipy/preview-html | ||
publish_dir: ./DocumentationHTML | ||
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 comment | ||
uses: hasura/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
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 }}/" |
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 |
---|---|---|
@@ -1,40 +1,46 @@ | ||
name: github pages | ||
name: Github Pages | ||
|
||
on: | ||
push: | ||
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 | ||
permissions: | ||
contents: write | ||
pull-requests: write | ||
issues: write | ||
env: | ||
PR_PATH: pull/${{github.event.number}} | ||
PR_PATH: dipy.org/pull/${{github.event.number}} | ||
BASE_URL: https://dipy.github.io/dipy.org | ||
HEAD: ${{ github.event.pull_request.head.repo.full_name }} | ||
BASE: ${{ github.repository }} | ||
NB: ${{github.event.number}} | ||
REF: ${{github.ref}} | ||
STATUS: ${{github.event.pull_request.head.repo.full_name != github.repository}} | ||
steps: | ||
- name: Comment on PR | ||
uses: hasura/[email protected] | ||
if: ${{ github.event.pull_request.head.repo.full_name != '' && github.event.pull_request.head.repo.full_name != github.repository }} | ||
- name: Save the PR number in an artifact | ||
if: ${{ github.event_name == '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_name == 'pull_request' }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
repository: ${{ github.repository }} | ||
number: ${{ github.event.number }} | ||
id: deploy-preview | ||
message: "Starting deployment of preview ⏳..." | ||
name: pull_request_number | ||
path: ./pull_request_number.txt | ||
|
||
- name: Checkout website repo | ||
uses: actions/checkout@v4 | ||
|
@@ -54,41 +60,47 @@ jobs: | |
make -C . html | ||
- name: Upload HTML | ||
uses: actions/upload-artifact@v1 | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: DocumentationHTML | ||
path: _build/html/ | ||
|
||
- name: Deploy to GitHub Pages | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{ github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == github.repository }} | ||
if: ${{ (github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == github.repository) && github.repository_owner == 'dipy'}} | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./_build/html | ||
user_name: 'github-actions[bot]' | ||
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: Deploy to PR preview | ||
- name: delete folder | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{ github.event.pull_request.head.repo.full_name != '' && github.event.pull_request.head.repo.full_name != github.repository }} | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./_build/html | ||
deploy_key: ${{ secrets.ACTIONS_DEPLOY_TOKEN }} | ||
external_repository: dipy/preview-html | ||
publish_dir: ./public | ||
publish_branch: main | ||
destination_dir: ${{ env.PR_PATH }} | ||
keep_files: true | ||
user_name: 'github-actions[bot]' | ||
user_email: 'github-actions[bot]@users.noreply.github.com' | ||
commit_message: ${{ github.event.head_commit.message }} | ||
|
||
- name: Update comment | ||
uses: hasura/[email protected] | ||
if: ${{ github.event.pull_request.head.repo.full_name != '' && github.event.pull_request.head.repo.full_name != github.repository }} | ||
- 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: "A preview of ${{ github.event.after }} 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/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/" | ||
|
||
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 }}/" |
Oops, something went wrong.