Skip to content

Commit

Permalink
update some preview path
Browse files Browse the repository at this point in the history
  • Loading branch information
skoudoro committed Sep 21, 2023
1 parent a943ce6 commit 1331563
Showing 1 changed file with 29 additions and 16 deletions.
45 changes: 29 additions & 16 deletions .github/workflows/preview-html.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Comment on the pull request.
name: HTML Preview

on:
workflow_run:
Expand Down Expand Up @@ -61,14 +61,23 @@ jobs:
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/dipy-preview
BASE_URL: https://dipy.github.io/preview-html
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: DocumentationHTML
- name: Unzip artifact
run: unzip DocumentationHTML.zip
- 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: ./_build/html
publish_dir: ./DocumentationHTML
publish_branch: main
destination_dir: ${{ env.PR_PATH }}
keep_files: true
Expand All @@ -82,30 +91,34 @@ jobs:
repository: ${{ github.repository }}
number: ${{ needs.get-pr-number.outputs.output1 }}
id: deploy-preview
message: "A preview of ${{ github.event.workflow_run.head_commit }} 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 }}/"
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 == 'pull_request_target' }}
env:
PR_PATH: pull/${{github.event.number}}
PR_PATH: dipy.org/pull/${{github.event.number}}
steps:
- name: Checkout website repo
uses: actions/checkout@v4
with:
ref: gh-pages
- name: make empty dir
run: mkdir public

- name: Delete preview
run: |
git rm -r ${{ env.PR_PATH }}
git commit -m "Delete preview for PR #${{ github.event.number }}"
git push origin gh-pages
- 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 }}
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: Comment on PR
- 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/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/"
message: "🪓 PR closed, deleted preview at https://github.com/dipy/preview-html/tree/main/${{ env.PR_PATH }}/"

0 comments on commit 1331563

Please sign in to comment.