Skip to content

Commit 41e7f27

Browse files
authored
[NO-ISSUE] Update preview and teardown documentation (quarkiverse#1539)
* Update preview workflow Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com> * Update preview and teardown Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com> --------- Signed-off-by: Matheus Cruz <matheuscruz.dev@gmail.com>
1 parent f8f7a7b commit 41e7f27

File tree

2 files changed

+54
-32
lines changed

2 files changed

+54
-32
lines changed

.github/workflows/preview.yml

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,48 +2,60 @@ name: Surge.sh Preview
22

33
on:
44
workflow_run:
5-
workflows: ["Build Website"]
5+
workflows: [ "Build Website" ]
66
types:
77
- completed
88

9+
defaults:
10+
run:
11+
shell: bash
12+
913
jobs:
1014
preview:
1115
runs-on: ubuntu-latest
12-
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
16+
if: |
17+
github.event.workflow_run.event == 'pull_request' &&
18+
github.event.workflow_run.conclusion == 'success' &&
19+
github.event.workflow_run.name == 'Build Website'
20+
permissions:
21+
actions: read
22+
pull-requests: write
1323
steps:
1424
- name: Download PR Artifact
15-
uses: dawidd6/action-download-artifact@v20
25+
uses: actions/download-artifact@v8
1626
with:
17-
workflow: ${{ github.event.workflow_run.workflow_id }}
18-
workflow_conclusion: success
1927
name: site
28+
github-token: ${{ secrets.GITHUB_TOKEN }}
29+
run-id: ${{ github.event.workflow_run.id }}
30+
2031
- name: Store PR id as variable
2132
id: pr
2233
run: |
23-
echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
24-
rm -f pr-id.txt
34+
echo "id=$(<pr-id.txt)" >> $GITHUB_OUTPUT
35+
2536
- name: Publishing to surge for preview
2637
id: deploy
27-
run: npx surge ./ --domain https://quarkus-openapi-generator-preview-pr-${{ steps.pr.outputs.id }}.surge.sh --token ${{ secrets.SURGE_LOCAL_TOKEN }}
38+
run: npx surge ./ --domain https://quarkiverse-openapi-generator-preview-pr-${{ steps.pr.outputs.id }}.surge.sh --token ${{ secrets.SURGE_TOKEN }}
39+
2840
- name: Update PR status comment on success
29-
uses: actions-cool/maintain-one-comment@v3.2.0
41+
uses: quarkusio/action-helpers@main
3042
with:
31-
token: ${{ secrets.GITHUB_TOKEN }}
43+
action: maintain-one-comment
44+
github-token: ${{ secrets.GITHUB_TOKEN }}
45+
pr-number: ${{ steps.pr.outputs.id }}
3246
body: |
33-
🎊 PR Preview ${{ github.sha }} has been successfully built and deployed. See the documentation preview: https://quarkus-openapi-generator-preview-pr-${{ steps.pr.outputs.id }}.surge.sh
34-
<!-- Sticky Pull Request Comment -->
35-
body-include: '<!-- Sticky Pull Request Comment -->'
36-
number: ${{ steps.pr.outputs.id }}
37-
emojis: 'heart'
47+
🚀 PR Preview ${{ github.sha }} has been successfully built and deployed to https://quarkiverse-openapi-generator-preview-pr-${{ steps.pr.outputs.id }}.surge.sh
48+
49+
<img width="300" src="https://user-images.githubusercontent.com/507615/90250366-88233900-de6e-11ea-95a5-84f0762ffd39.png">
50+
body-marker: <!-- Preview status comment marker -->
3851
- name: Update PR status comment on failure
52+
uses: quarkusio/action-helpers@main
3953
if: ${{ failure() }}
40-
uses: actions-cool/maintain-one-comment@v3.2.0
4154
with:
42-
token: ${{ secrets.GITHUB_TOKEN }}
55+
action: maintain-one-comment
56+
github-token: ${{ secrets.GITHUB_TOKEN }}
57+
pr-number: ${{ steps.pr.outputs.id }}
4358
body: |
4459
😭 Deploy PR Preview failed.
4560
<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 }}
49-
emojis: 'confused'
61+
body-marker: <!-- Preview status comment marker -->
Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
1-
name: Surge.sh Preview Teardown
1+
name: Surge.sh Teardown
22

33
on:
44
pull_request_target:
5-
paths:
6-
- '*.adoc'
75
types: [closed]
86

97
jobs:
10-
preview-teardown:
8+
preview:
119
runs-on: ubuntu-latest
10+
permissions:
11+
pull-requests: write
1212
steps:
1313
- name: Teardown surge preview
1414
id: deploy
15-
run: npx surge teardown https://quarkus-openapi-generator-preview-pr-${{ github.event.number }}.surge.sh --token ${{ secrets.SURGE_TOKEN }}
16-
- name: Update PR status comment
17-
uses: actions-cool/maintain-one-comment@v3.2.0
15+
run: npx surge teardown https://quarkiverse-openapi-generator-preview-pr-${{ github.event.number }}.surge.sh --token ${{ secrets.SURGE_TOKEN }}
16+
- name: Update PR status comment on success
17+
uses: quarkusio/action-helpers@main
1818
with:
19-
token: ${{ secrets.GITHUB_TOKEN }}
19+
action: maintain-one-comment
20+
github-token: ${{ secrets.GITHUB_TOKEN }}
21+
pr-number: ${{ github.event.number }}
2022
body: |
2123
🙈 The PR is closed and the preview is expired.
22-
<!-- Sticky Pull Request Comment -->
23-
body-include: '<!-- Sticky Pull Request Comment -->'
24-
number: ${{ github.event.number }}
24+
body-marker: <!-- Preview status comment marker -->
25+
- name: Update PR status comment on failure
26+
uses: quarkusio/action-helpers@main
27+
if: ${{ failure() }}
28+
with:
29+
action: maintain-one-comment
30+
github-token: ${{ secrets.GITHUB_TOKEN }}
31+
pr-number: ${{ github.event.number }}
32+
body: |
33+
😭 Failed to teardown preview for this PR. Please check the workflow logs.
34+
body-marker: <!-- Preview status comment marker -->

0 commit comments

Comments
 (0)