@@ -71,32 +71,32 @@ jobs:
7171 return;
7272 }
7373
74- // workflow_run.pull_requests is empty for fork PRs, so fall back to
75- // the PRs associated with the built commit and require exactly one
76- // open PR from the same head repository and branch.
77- let pull = null;
78- const listed = run.pull_requests?.[0]?.number;
79- if (listed) {
80- pull = (await github.rest.pulls.get({ owner, repo, pull_number: listed })).data;
81- } else {
82- const associated = await github.paginate(
83- github.rest.repos.listPullRequestsAssociatedWithCommit,
84- { owner, repo, commit_sha: run.head_sha, per_page: 100 },
85- );
86- const matching = associated.filter(
87- (candidate) =>
88- candidate.state === "open" &&
89- candidate.head.sha === run.head_sha &&
90- candidate.head.ref === run.head_branch &&
91- candidate.head.repo?.full_name === run.head_repository?.full_name,
92- );
93- if (matching.length !== 1) {
94- core.info(`Expected one open PR for ${run.head_sha}; found ${matching.length}. Skipping.`);
95- core.setOutput("eligible", "false");
96- return;
97- }
98- pull = (await github.rest.pulls.get({ owner, repo, pull_number: matching[0].number })).data;
74+ // workflow_run.pull_requests is empty for fork PRs, so resolve the
75+ // PR from the built commit instead and require exactly one open PR
76+ // from the same head repository and branch. The build baked its
77+ // PR number into the version, so two candidates would mean the
78+ // asset name could belong to either.
79+ const associated = await github.paginate(
80+ github.rest.repos.listPullRequestsAssociatedWithCommit,
81+ { owner, repo, commit_sha: run.head_sha, per_page: 100 },
82+ );
83+ const matching = associated.filter(
84+ (candidate) =>
85+ candidate.state === "open" &&
86+ candidate.head.sha === run.head_sha &&
87+ candidate.head.ref === run.head_branch &&
88+ candidate.head.repo?.full_name === run.head_repository?.full_name,
89+ );
90+ if (matching.length !== 1) {
91+ core.info(`Expected one open PR for ${run.head_sha}; found ${matching.length}. Skipping.`);
92+ core.setOutput("eligible", "false");
93+ return;
9994 }
95+ const { data: pull } = await github.rest.pulls.get({
96+ owner,
97+ repo,
98+ pull_number: matching[0].number,
99+ });
100100
101101 if (pull.state !== "open") {
102102 core.info(`PR #${pull.number} is not open. Skipping.`);
@@ -177,8 +177,12 @@ jobs:
177177 }
178178
179179 base_version="$(head_file apps/desktop/package.json | node -p "JSON.parse(require('fs').readFileSync(0, 'utf8')).version")"
180- if [[ ! "$base_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then
181- echo "Unexpected desktop version '$base_version' at $HEAD_SHA." >&2
180+ # The committed desktop version is always a plain X.Y.Z; every
181+ # prerelease identifier is added by a release run. Anything else
182+ # would also let a foreign -pr.N. marker into the asset name, which
183+ # is what publish and cleanup key on.
184+ if [[ ! "$base_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
185+ echo "Unexpected desktop version '$base_version' at $HEAD_SHA; expected X.Y.Z." >&2
182186 exit 1
183187 fi
184188 echo "version=${base_version}-pr.${PR_NUMBER}.${BUILD_RUN_NUMBER}" >> "$GITHUB_OUTPUT"
@@ -214,6 +218,8 @@ jobs:
214218 name : js-bundle
215219 path : ${{ runner.temp }}/js-bundle
216220 if-no-files-found : error
221+ # Re-running this workflow re-uploads under the same run.
222+ overwrite : true
217223 retention-days : 1
218224
219225 build :
@@ -253,9 +259,12 @@ jobs:
253259 if : needs.resolve.outputs.eligible == 'true' && needs.build.result == 'success'
254260 runs-on : blacksmith-8vcpu-ubuntu-2404
255261 timeout-minutes : 10
262+ # Its own group, so a publish never cancels a newer commit's signing job
263+ # (they would share the build group) and is never cancelled mid-upload.
264+ # preview_eligible's head check keeps a superseded publish from landing.
256265 concurrency :
257- group : desktop-macos-preview-${{ needs.resolve.outputs.pr_number }}-build
258- cancel-in-progress : true
266+ group : desktop-macos-preview-${{ needs.resolve.outputs.pr_number }}-publish
267+ cancel-in-progress : false
259268 permissions :
260269 contents : write
261270 pull-requests : write
@@ -386,7 +395,7 @@ jobs:
386395 `Version: ${process.env.PREVIEW_VERSION}`,
387396 `Commit: ${process.env.HEAD_SHA.slice(0, 7)}`,
388397 "",
389- "Signed and notarized, with T3 Connect enabled. Packaging and native helpers come from ` main`; only the JS bundle is built from this PR.",
398+ "Signed and notarized, with T3 Connect enabled. The app bundle (server, web client, Electron main) is built from this PR; packaging, native helpers, and desktop dependencies come from `main` .",
390399 "",
391400 "No GitHub sign-in is needed. The download stays available until this PR closes or the preview label is removed.",
392401 ].join("\n");
0 commit comments