-
Notifications
You must be signed in to change notification settings - Fork 176
57 lines (54 loc) · 1.98 KB
/
Copy pathpreview.yml
File metadata and controls
57 lines (54 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Surge PR Preview
on:
workflow_run:
workflows: [ "Build" ]
types:
- completed
branches-ignore:
- "main"
permissions:
actions: read
pull-requests: write
jobs:
preview:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
steps:
- name: Download PR Artifact
uses: actions/download-artifact@v8
with:
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}
name: site
- name: Store PR id as variable
id: pr
run: |
echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
rm -f pr-id.txt
- name: Trim site for preview
run: |
cd super-heroes/variants
rm -rf os-linux-* os-windows-*
du -sh ..
- name: Publishing to surge for preview
id: deploy
run: npx surge@0.23.1 ./ --domain quarkus-workshops-pr-${{ steps.pr.outputs.id }}-preview.surge.sh --token ${{ secrets.SURGE_TOKEN }}
- name: Update PR status comment on success
uses: quarkusio/action-helpers@main
with:
action: maintain-one-comment
github-token: ${{ secrets.GITHUB_TOKEN }}
body: |
🚀 PR Preview ${{ github.sha }} has been successfully built and deployed to https://quarkus-workshops-pr-${{ steps.pr.outputs.id }}-preview.surge.sh. Note that in order to limit the site size, not all variants are deployed.
body-marker: '<!-- Sticky Pull Request Comment -->'
pr-number: ${{ steps.pr.outputs.id }}
- name: Update PR status comment on failure
uses: quarkusio/action-helpers@main
if: ${{ failure() }}
with:
action: maintain-one-comment
github-token: ${{ secrets.GITHUB_TOKEN }}
body: |
😭 Deploy PR Preview failed.
body-marker: '<!-- Sticky Pull Request Comment -->'
pr-number: ${{ steps.pr.outputs.id }}