-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Support preview from forked repositories 15"
This reverts commit 6275bcb. Revert "Support preview from forked repositories 14" This reverts commit e52cb38. Revert "Support preview from forked repositories 13" This reverts commit b14ad16. Revert "Support preview from forked repositories 12 - Merge workflows" This reverts commit fcdbe32.
- Loading branch information
Showing
2 changed files
with
64 additions
and
56 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,64 @@ | ||
name: Surge.sh Preview | ||
|
||
on: | ||
workflow_run: | ||
workflows: [ "Publish website" ] | ||
types: | ||
- completed | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
preview: | ||
runs-on: ubuntu-latest | ||
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' | ||
permissions: | ||
pull-requests: write # Required to update PR status comment | ||
steps: | ||
- name: Download PR Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: site | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
run-id: ${{ github.event.workflow_run.id }} | ||
|
||
- name: Download PR ID Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: pr-id | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
run-id: ${{ github.event.workflow_run.id }} | ||
|
||
- name: Store PR id as variable | ||
id: pr | ||
run: | | ||
echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT | ||
rm -f pr-id.txt | ||
- name: Publishing to surge for preview | ||
id: deploy | ||
run: npx surge ./ --domain https://quarkiverse-docs-pr-${{ steps.pr.outputs.id }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }} | ||
|
||
- name: Update PR status comment on success | ||
uses: actions-cool/maintain-one-comment@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: | | ||
🚀 PR Preview ${{ github.sha }} has been successfully built and deployed to https://quarkiverse-docs-pr-${{ steps.pr.outputs.id }}-preview.surge.sh | ||
<!-- Sticky Pull Request Comment --> | ||
body-include: '<!-- Sticky Pull Request Comment -->' | ||
number: ${{ steps.pr.outputs.id }} | ||
|
||
- name: Update PR status comment on failure | ||
if: ${{ failure() }} | ||
uses: actions-cool/maintain-one-comment@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: | | ||
😭 Deploy PR Preview failed. | ||
<img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png"> | ||
<!-- Sticky Pull Request Comment --> | ||
body-include: '<!-- Sticky Pull Request Comment -->' | ||
number: ${{ steps.pr.outputs.id }} |
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