1+ name : Surge PR Preview
2+
3+ on :
4+ workflow_run :
5+ workflows : [ "Gatsby Publish" ]
6+ types :
7+ - completed
8+
9+ jobs :
10+ preview :
11+ runs-on : ubuntu-20.04
12+ if : github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
13+ steps :
14+ - name : Download PR Artifact
15+ uses : dawidd6/action-download-artifact@v2
16+ with :
17+ workflow : ${{ github.event.workflow_run.workflow_id }}
18+ workflow_conclusion : success
19+ name : site
20+ - name : Store PR id as variable
21+ id : pr
22+ run : |
23+ echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
24+ rm -f pr-id.txt
25+ - name : Publishing to surge for preview
26+ id : deploy
27+ run : npx surge ./ --domain https://extensions-quarkus-io-pr-${{ steps.pr.outputs.id }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }}
28+ - name : Update PR status comment on success
29+ uses :
actions-cool/[email protected] 30+ with :
31+ token : ${{ secrets.GITHUB_TOKEN }}
32+ body : |
33+ 🚀 PR Preview ${{ github.sha }} has been successfully built and deployed to https://quarkus-io-pr-${{ steps.pr.outputs.id }}-preview.surge.sh
34+ <img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png">
35+ <!-- Sticky Pull Request Comment -->
36+ body-include : ' <!-- Sticky Pull Request Comment -->'
37+ number : ${{ steps.pr.outputs.id }}
38+ - name : Update PR status comment on failure
39+ if : ${{ failure() }}
40+ uses :
actions-cool/[email protected] 41+ with :
42+ token : ${{ secrets.GITHUB_TOKEN }}
43+ body : |
44+ 😭 Deploy PR Preview failed.
45+ <img width="300" src="https://user-images.githubusercontent.com/507615/90250824-4e066700-de6f-11ea-8230-600ecc3d6a6b.png">
46+ <!-- Sticky Pull Request Comment -->
47+ body-include : ' <!-- Sticky Pull Request Comment -->'
48+ number : ${{ steps.pr.outputs.id }}
0 commit comments