File tree Expand file tree Collapse file tree 3 files changed +69
-1
lines changed Expand file tree Collapse file tree 3 files changed +69
-1
lines changed Original file line number Diff line number Diff line change
1
+ import os
2
+ import re
3
+
4
+ deploy_output = os .environ ['DEPLOY_OUTPUT' ]
5
+
6
+ m = re .search (r'https://(\S+)\.workers\.dev' , deploy_output )
7
+ assert m , f'Could not find worker URL in { deploy_output !r} '
8
+ worker_name = m .group (1 )
9
+
10
+ m = re .search (r'Current Version ID: ([^-]+)' , deploy_output )
11
+ assert m , f'Could not find version ID in { deploy_output !r} '
12
+ version_id = m .group (1 )
13
+
14
+ preview_url = f'https://{ version_id } -{ worker_name } .workers.dev'
15
+
16
+ print (f'preview_url={ preview_url } ' )
Original file line number Diff line number Diff line change 1
- name : Smokeshow
1
+ name : After CI
2
2
3
3
on :
4
4
workflow_run :
45
45
SMOKESHOW_GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
46
46
SMOKESHOW_GITHUB_PR_HEAD_SHA : ${{ github.event.workflow_run.head_sha }}
47
47
SMOKESHOW_AUTH_KEY : ${{ secrets.SMOKESHOW_AUTH_KEY }}
48
+
49
+ deploy-docs-preview :
50
+ runs-on : ubuntu-latest
51
+ needs : [check]
52
+ environment :
53
+ name : deploy-preview
54
+ url : ${{ steps.get_preview_url.outputs.preview_url }}
55
+
56
+ steps :
57
+ - uses : dawidd6/action-download-artifact@v6
58
+ with :
59
+ workflow : ci.yml
60
+ name : docs-site
61
+ commit : ${{ github.event.workflow_run.head_sha }}
62
+ allow_forks : true
63
+ workflow_conclusion : completed
64
+ if_no_artifact_found : warn
65
+
66
+ - uses : actions/setup-node@v4
67
+ - run : npm install
68
+
69
+ - run : ' echo head_sha $VAR'
70
+ env :
71
+ VAR : ${{ github.event.workflow_run.head_sha }}
72
+
73
+ - run : ' echo head_branch $VAR'
74
+ env :
75
+ VAR : ${{ github.event.workflow_run.head_branch }}
76
+
77
+ - uses : cloudflare/wrangler-action@v3
78
+ name : Deploy docs-preview
79
+ id : deploy
80
+ with :
81
+ apiToken : ${{ secrets.CLOUDFLARE_API_TOKEN }}
82
+ environment : previews
83
+ workingDirectory : docs-site
84
+ command : >
85
+ deploy
86
+ --var GIT_COMMIT_SHA:${{ github.event.workflow_run.head_sha }}
87
+ --var GIT_BRANCH:${{ github.event.workflow_run.head_branch }}
88
+
89
+ - name : get preview URL
90
+ id : get_preview_url
91
+ run : python .github/get_preview_url.py >> $GITHUB_OUTPUT
92
+ env :
93
+ DEPLOY_OUTPUT : ${{ steps.deploy.outputs.command-output }}
Original file line number Diff line number Diff line change 75
75
76
76
- run : tree site
77
77
78
+ - name : Store docs
79
+ uses : actions/upload-artifact@v4
80
+ with :
81
+ name : docs-site
82
+ path : site
83
+
78
84
test-live :
79
85
runs-on : ubuntu-latest
80
86
timeout-minutes : 5
You can’t perform that action at this time.
0 commit comments