@@ -3,35 +3,14 @@ name: Publish PR Preview
33on :
44 pull_request :
55 types : [labeled]
6- workflow_dispatch :
7- inputs :
8- pr_number :
9- description : Pull request number to publish
10- required : true
11- type : string
12- publish_test_pypi :
13- description : Publish the Python package to TestPyPI
14- required : true
15- default : true
16- type : boolean
17- publish_docker :
18- description : Publish socketdev/cli:pr-<number> to Docker Hub
19- required : true
20- default : false
21- type : boolean
22- sdk_preview_version :
23- description : Optional exact TestPyPI socketdev prerelease for the Docker image
24- required : false
25- type : string
266
277concurrency :
28- group : publish-pr-preview-${{ github.event.pull_request.number || github.run_id }}
8+ group : publish-pr-preview-${{ github.event.pull_request.number }}
299 cancel-in-progress : false
3010
3111jobs :
3212 context :
3313 if : >-
34- github.event_name == 'workflow_dispatch' ||
3514 (github.event.label.name == 'publish-preview' ||
3615 github.event.label.name == 'publish-docker-preview') &&
3716 github.event.pull_request.head.repo.full_name == github.repository
@@ -48,28 +27,15 @@ jobs:
4827 id : context
4928 uses : actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
5029 env :
51- DEFAULT_BRANCH : ${{ github.event.repository.default_branch }}
5230 EVENT_PR_NUMBER : ${{ github.event.pull_request.number }}
53- INPUT_PR_NUMBER : ${{ inputs.pr_number }}
54- WORKFLOW_REF : ${{ github.ref }}
5531 with :
5632 script : |
57- const rawPrNumber = context.eventName === 'workflow_dispatch'
58- ? process.env.INPUT_PR_NUMBER
59- : process.env.EVENT_PR_NUMBER;
33+ const rawPrNumber = process.env.EVENT_PR_NUMBER;
6034 if (!/^[1-9][0-9]*$/.test(rawPrNumber || '')) {
6135 core.setFailed('Pull request number must contain ASCII digits only.');
6236 return;
6337 }
6438
65- if (context.eventName === 'workflow_dispatch') {
66- const defaultRef = `refs/heads/${process.env.DEFAULT_BRANCH}`;
67- if (process.env.WORKFLOW_REF !== defaultRef) {
68- core.setFailed(`Run manual previews from ${defaultRef}.`);
69- return;
70- }
71- }
72-
7339 const prNumber = Number(rawPrNumber);
7440 if (!Number.isSafeInteger(prNumber)) {
7541 core.setFailed('Pull request number is outside the supported range.');
@@ -162,9 +128,7 @@ jobs:
162128
163129 publish-package :
164130 needs : [context, build]
165- if : >-
166- github.event.label.name == 'publish-preview' ||
167- (github.event_name == 'workflow_dispatch' && inputs.publish_test_pypi)
131+ if : github.event.label.name == 'publish-preview'
168132 runs-on : ubuntu-latest
169133 timeout-minutes : 10
170134 permissions :
@@ -228,9 +192,7 @@ jobs:
228192
229193 publish-docker :
230194 needs : [context, build]
231- if : >-
232- github.event.label.name == 'publish-docker-preview' ||
233- (github.event_name == 'workflow_dispatch' && inputs.publish_docker)
195+ if : github.event.label.name == 'publish-docker-preview'
234196 runs-on : ubuntu-latest
235197 timeout-minutes : 15
236198 permissions :
@@ -274,8 +236,6 @@ jobs:
274236 # arm64 layer builds under emulation, so expect roughly double the runtime.
275237 platforms : linux/amd64,linux/arm64
276238 tags : socketdev/cli:pr-${{ needs.context.outputs.pr_number }}
277- build-args : |
278- SDK_PREVIEW_VERSION=${{ inputs.sdk_preview_version }}
279239
280240 - name : Comment on pull request
281241 uses : actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
0 commit comments