Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/fix-alpha-dist-tag-promotion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -881,8 +881,8 @@ jobs:
# so bare `npx @zitadel/cli` must reach the supported local workflow.
# Keep `alpha` as the canonical prerelease tag, and do not move
# `latest` for SDKs/components, Docker images, or GitHub Releases.
npm dist-tag add "@zitadel/cli@$version" alpha
npm dist-tag add "@zitadel/cli@$version" latest
npm dist-tag add "@zitadel/cli@$version" alpha || echo "::warning::Unable to refresh @zitadel/cli@$version npm alpha dist-tag"
npm dist-tag add "@zitadel/cli@$version" latest || echo "::warning::Unable to promote @zitadel/cli@$version to npm latest dist-tag"

- name: Restore changesets after publish decision
run: git restore -- .changeset
Expand Down
21 changes: 17 additions & 4 deletions apps/cli/tests/unit/scripts/check-alpha-release-plan.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ describe("check-alpha-release-plan script", () => {
" - name: Promote CLI alpha to npm latest",
" if: ${{ steps.changesets.outputs.published == 'true' }}",
" run: |",
" npm dist-tag add \"@zitadel/cli@$version\" alpha",
" npm dist-tag add \"@zitadel/cli@$version\" latest",
' npm dist-tag add "@zitadel/cli@$version" alpha || echo "::warning::Unable to refresh @zitadel/cli@$version npm alpha dist-tag"',
' npm dist-tag add "@zitadel/cli@$version" latest || echo "::warning::Unable to promote @zitadel/cli@$version to npm latest dist-tag"',
"",
].join("\n"),
"",
Expand Down Expand Up @@ -225,6 +225,19 @@ describe("check-alpha-release-plan script", () => {
).rejects.toThrow("must keep the CLI alpha dist-tag on the published train");
});

it("rejects a workflow that fails the train when npm latest promotion fails", async () => {
const { cwd, statusPath } = await fixtureRepo({
ciWorkflow: validCiWorkflow().replace(
' npm dist-tag add "@zitadel/cli@$version" latest || echo "::warning::Unable to promote @zitadel/cli@$version to npm latest dist-tag"',
' npm dist-tag add "@zitadel/cli@$version" latest',
),
});

await expect(
checkAlphaReleasePlanModule.checkAlphaReleasePlan({ cwd, statusPath }),
).rejects.toThrow("must not fail the alpha train when npm latest dist-tag promotion fails");
});
Comment on lines +228 to +239

it("rejects a workflow that moves the CLI latest tag outside the release job", async () => {
const { cwd, statusPath } = await fixtureRepo({
ciWorkflow: validCiWorkflow()
Expand Down Expand Up @@ -382,8 +395,8 @@ function validCiWorkflow(): string {
" - name: Promote CLI alpha to npm latest",
" if: ${{ steps.changesets.outputs.published == 'true' }}",
" run: |",
" npm dist-tag add \"@zitadel/cli@$version\" alpha",
" npm dist-tag add \"@zitadel/cli@$version\" latest",
' npm dist-tag add "@zitadel/cli@$version" alpha || echo "::warning::Unable to refresh @zitadel/cli@$version npm alpha dist-tag"',
' npm dist-tag add "@zitadel/cli@$version" latest || echo "::warning::Unable to promote @zitadel/cli@$version to npm latest dist-tag"',
"",
" - name: Restore changesets after publish decision",
" run: git restore -- .changeset",
Expand Down
5 changes: 5 additions & 0 deletions scripts/check-alpha-release-plan.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ function assertCliLatestPromotion(ciWorkflow) {
throw new Error("only @zitadel/cli may move the npm latest dist-tag during alpha");
}
}
assertContains(
releaseJob,
'npm dist-tag add "@zitadel/cli@$version" latest ||',
"release-alpha-train must not fail the alpha train when npm latest dist-tag promotion fails",
);
Comment on lines +289 to +293
}

function assertNoUnexpectedPublishOnlyGates(ciWorkflow) {
Expand Down
Loading