Skip to content

Commit 2ece734

Browse files
authored
chore: standalone release jobs are always skipped (#1589)
The release workflow's three "standalone" jobs — publish the standalone CLI to ADC, record the publishing timestamp in SSM, and publish the toolkit-lib api-extractor model to S3 — were skipped on virtually every release, including releases where `aws-cdk` and `@aws-cdk/toolkit-lib` were actually published. For example, run [26519804668](https://github.com/aws/aws-cdk-cli/actions/runs/26519804668) published both `aws-cdk` and `toolkit-lib` to npm successfully and created their GitHub releases, yet all three standalone jobs skipped. The cause is GitHub's implicit success gate. When a job's `if` contains no status-check function, GitHub evaluates an implicit `success()` over the job's entire transitive `needs` graph, and a skipped job anywhere upstream makes that gate `false` regardless of what the `if` expression itself says. The package publish jobs survive skipped upstreams only because they use `!cancelled() && !failure()`; the standalone jobs did not. Since almost every release leaves at least one package un-republished — its publish job is skipped because the version was unchanged — the transitive gate was poisoned and the standalone jobs were skipped even though their own publish job succeeded. The fix adds `!cancelled()` so these jobs opt out of the implicit transitive gate, and gates them explicitly on the result of the direct npm publish job they care about (`needs.<pkg>_release_npm.result == 'success'`). That preserves the original intent — only run once the relevant package has actually been published — without being dragged down by unrelated packages that were not part of this release. The redundant `latest_commit == github.sha` check is dropped because a successful publish of that job already implies it. The condition is centralized in a new `runAfterPublish` helper in `projenrc/util.ts` so the three jobs share a single definition. Fixes # ### Checklist - [ ] This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed - Release notes for the new version: --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
1 parent c23d53a commit 2ece734

5 files changed

Lines changed: 20 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

projenrc/adc-publishing.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Monorepo } from 'cdklabs-projen-project-types/lib/yarn';
22
import { Component, github } from 'projen';
33
import { JobPermission } from 'projen/lib/github/workflows-model';
4+
import { runAfterPublish } from './util';
45

56
export class AdcPublishing extends Component {
67
constructor(private readonly project_: Monorepo) {
@@ -42,7 +43,7 @@ export class AdcPublishing extends Component {
4243
contents: JobPermission.WRITE,
4344
idToken: JobPermission.WRITE,
4445
},
45-
if: '${{ needs.release.outputs.latest_commit == github.sha && !inputs.dry_run }}',
46+
if: runAfterPublish('aws-cdk_release_npm'),
4647
steps: [
4748
github.WorkflowSteps.checkout(),
4849
...this.project_.renderWorkflowSetup(),

projenrc/record-publishing-timestamp.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Monorepo } from 'cdklabs-projen-project-types/lib/yarn';
22
import { Component, github } from 'projen';
33
import { JobPermission } from 'projen/lib/github/workflows-model';
4+
import { runAfterPublish } from './util';
45

56
/**
67
* Record publishing timestamp to SSM
@@ -27,7 +28,7 @@ export class RecordPublishingTimestamp extends Component {
2728
contents: JobPermission.WRITE,
2829
idToken: JobPermission.WRITE,
2930
},
30-
if: '${{ needs.release.outputs.latest_commit == github.sha && !inputs.dry_run }}',
31+
if: runAfterPublish('aws-cdk_release_npm'),
3132
steps: [
3233
github.WorkflowSteps.downloadArtifact({
3334
with: {

projenrc/s3-docs-publishing.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Monorepo, TypeScriptWorkspace } from 'cdklabs-projen-project-types/lib/yarn';
22
import { Component, github } from 'projen';
3+
import { runAfterPublish } from './util';
34

45
export enum DocType {
56
/**
@@ -76,7 +77,7 @@ export class S3DocsPublishing extends Component {
7677
environment: 'releasing', // <-- this has the configuration
7778
needs: [`${safeName}_release_npm`],
7879
runsOn: ['ubuntu-latest'],
79-
if: '${{ !inputs.dry_run }}',
80+
if: runAfterPublish(`${safeName}_release_npm`),
8081
permissions: {
8182
idToken: github.workflows.JobPermission.WRITE,
8283
contents: github.workflows.JobPermission.READ,

projenrc/util.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,14 @@ export class GitHubToken {
99
export function stringifyList(list: string[]) {
1010
return `[${list.join('|')}]`;
1111
}
12+
13+
/**
14+
* Workflow `if` condition for jobs that should run after a package's npm publish job.
15+
*
16+
* `!cancelled()` opts out of the implicit (transitive) `success()` gate that would
17+
* otherwise skip the job whenever any unrelated package in the release graph wasn't
18+
* republished. We gate on the direct publish job's result instead.
19+
*/
20+
export function runAfterPublish(npmJobId: string): string {
21+
return `\${{ !cancelled() && needs.${npmJobId}.result == 'success' && !inputs.dry_run }}`;
22+
}

0 commit comments

Comments
 (0)