-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add preview deployment and deletion pipelines
- Loading branch information
1 parent
1d0a30a
commit c078c90
Showing
2 changed files
with
72 additions
and
0 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
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 on PR close | ||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
jobs: | ||
delete_preview: | ||
runs-on: ubuntu-20.04 | ||
env: | ||
PR_PATH: pull/${{github.event.number}} | ||
DOMAIN: gradle.github.io | ||
PREVIEW_REPO: community-site-preview | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
steps: | ||
- name: make empty dir | ||
run: mkdir public | ||
|
||
- name: delete folder | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
deploy_key: ${{ secrets.PREVIEW_DEPLOYMENT_KEY }} | ||
external_repository: gradle/${{ env.PREVIEW_REPO }} | ||
publish_dir: ./public | ||
destination_dir: ${{ env.PR_PATH }} | ||
|
||
- name: Comment on PR | ||
uses: hasura/comment-progress@v2.2.0 | ||
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/${{ env.PREVIEW_REPO }}/tree/gh-pages/${{ env.PR_PATH }}/ |