5
5
types :
6
6
- completed
7
7
8
+ concurrency :
9
+ # see https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
10
+ group : ${{github.event.workflow_run.id }}-${{ github.ref }}
11
+ cancel-in-progress : true
12
+
13
+ env :
14
+ DEPLOY_HOST_URL : https://fluentuipr.z22.web.core.windows.net/
15
+
16
+ # GitHub Secrets for Azure access
17
+ # This service principal ("subscription" is a misleading name) only has access to the fluentuipr storage account
18
+ AZURE_SUBSCRIPTION : Azure PR deploy - NEW
19
+ AZURE_STORAGE : fluentuipr
20
+
8
21
jobs :
9
- comment :
22
+ deploy :
10
23
runs-on : ubuntu-latest
11
24
if : ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
12
- permissions :
13
- pull-requests : write
25
+ outputs :
26
+ pr_number : ${{ steps.pr_number.outputs.id }}
27
+ website_url : ${{ steps.website_url.outputs.id }}
14
28
steps :
15
- - name : Download artifact
29
+ - name : Download WebSite artifacts
16
30
uses : actions/download-artifact@v4
17
31
with :
18
- name : monosize-report
19
- path : ./results
32
+ name : pr-website-artifacts
33
+ path : ./website
20
34
run_id : ${{ github.event.workflow_run.id }}
21
35
github-token : ${{ secrets.GITHUB_TOKEN }}
22
36
23
- # - name: 'Download artifact'
24
- # uses: dawidd6/action-download-artifact@v2
25
- # with:
26
- # name: pr-website-deploy-url
27
- # path: ./results
28
- # run_id: ${{ github.event.workflow_run.id }}
29
- # workflow: ${{ github.event.workflow.id }}
30
- # workflow_conclusion: success
37
+ - uses : actions/download-artifact@v4
38
+ with :
39
+ name : pr-number
40
+ path : ./results
41
+ run_id : ${{ github.event.workflow_run.id }}
42
+ github-token : ${{ secrets.GITHUB_TOKEN }}
31
43
32
44
- name : Load PR number
33
45
id : pr_number
@@ -36,21 +48,49 @@ jobs:
36
48
37
49
- name : Load URL
38
50
id : website_url
39
- run : echo "::set-output name=id::$(cat website-deploy-url.txt)"
40
- working-directory : ./results
51
+ run : echo "::set-output name=id::${{env.DEPLOY_HOST_URL}}pull/${{steps.pr_number.outputs.id}}"
52
+
53
+ - name : Login via Azure CLI
54
+ uses : azure/login@v2
55
+ with :
56
+ client-id : ${{ secrets.AZURE_CLIENT_ID }}
57
+ tenant-id : ${{ secrets.AZURE_TENANT_ID }}
58
+ subscription-id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
41
59
60
+ - name : Upload PR WebSite
61
+ uses : azure/cli@v2
62
+ env :
63
+ AZCOPY_AUTO_LOGIN_TYPE : ' AZCLI'
64
+ with :
65
+ azcliversion : latest
66
+ inlineScript : |
67
+ az storage blob upload-batch \
68
+ --destination '$web' \
69
+ --source ./website \
70
+ --account-name ${{ env.AZURE_STORAGE }} \
71
+ --destination-path pull/${{steps.pr_number.outputs.id}} \
72
+ --auth-mode login \
73
+ --overwrite
74
+
75
+ comment :
76
+ runs-on : ubuntu-latest
77
+ needs : deploy
78
+ if : ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
79
+ permissions :
80
+ pull-requests : write
81
+ steps :
42
82
- name : ' Comment on PR'
43
83
uses : marocchino/sticky-pull-request-comment@v2
44
84
with :
45
- number : ${{ steps.pr_number .outputs.id }}
85
+ number : ${{ needs.deploy .outputs.pr_number }}
46
86
message : |
47
- Pull request demo site: [URL](${{steps.pr_number .outputs.id }})
87
+ Pull request demo site: [URL](${{needs.deploy .outputs.website_url }})
48
88
49
89
- name : Update PR deploy site GitHub status
50
90
if : github.event_name == 'pull_request'
51
91
uses : actions/github-script@v7
52
92
with :
53
93
script : |
54
94
const run = require('./.github/deploy-pr-site-status');
55
- const config = { websiteUrl: '${{steps.website_url .outputs.id }}', prId: '${{steps.pr_number .outputs.id }}'};
95
+ const config = { websiteUrl: '${{ needs.deploy .outputs.website_url }}', prId: '${{ needs.deploy .outputs.pr_number }}'};
56
96
await run({github,context,core,config});
0 commit comments