Skip to content

Commit 424de1a

Browse files
committed
feat(ci): support release candidates via changesets pre mode
Detect prereleases by hyphen-in-version in release.yml and: - mark the GitHub release with --prerelease (no Latest badge) - skip the marketing-site changelog dispatch (no PR per RC) - keep the dispatch firing for stable releases Also fix the CLI version-check (initialBanner.ts) to use semver.lt instead of locale string compare so users on an RC are correctly told to upgrade once the matching stable ships. Removes the stale :v4-beta Docker floating tag from the webapp and worker-v4 publish workflows. v4 is GA; the tag is misleading and inconsistent with the npm side (where v4-beta is already frozen at 4.0.4). Self-hosters should pin to a versioned tag.
1 parent 454f0c9 commit 424de1a

4 files changed

Lines changed: 21 additions & 21 deletions

File tree

.github/workflows/publish-webapp.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,6 @@ jobs:
5353
ref_without_tag=ghcr.io/triggerdotdev/trigger.dev
5454
image_tags=$ref_without_tag:${STEPS_GET_TAG_OUTPUTS_TAG}
5555
56-
# if tag is a semver, also tag it as v4
57-
if [[ "${STEPS_GET_TAG_OUTPUTS_IS_SEMVER}" == true ]]; then
58-
# TODO: switch to v4 tag on GA
59-
image_tags=$image_tags,$ref_without_tag:v4-beta
60-
fi
61-
6256
# when pushing the mutable main tag, also push an immutable-by-convention
6357
# full-commit-sha tag so a commit can be resolved to a specific digest
6458
if [[ "${STEPS_GET_TAG_OUTPUTS_TAG}" == "main" ]]; then

.github/workflows/publish-worker-v4.yml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,6 @@ jobs:
6868
ref_without_tag=ghcr.io/triggerdotdev/${STEPS_GET_REPOSITORY_OUTPUTS_REPO}
6969
image_tags=$ref_without_tag:${STEPS_GET_TAG_OUTPUTS_TAG}
7070
71-
# if tag is a semver, also tag it as v4
72-
if [[ "${STEPS_GET_TAG_OUTPUTS_IS_SEMVER}" == true ]]; then
73-
# TODO: switch to v4 tag on GA
74-
image_tags=$image_tags,$ref_without_tag:v4-beta
75-
fi
76-
7771
echo "image_tags=${image_tags}" >> "$GITHUB_OUTPUT"
7872
env:
7973
STEPS_GET_REPOSITORY_OUTPUTS_REPO: ${{ steps.get_repository.outputs.repo }}

.github/workflows/release.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
published: ${{ steps.changesets.outputs.published }}
6565
published_packages: ${{ steps.changesets.outputs.publishedPackages }}
6666
published_package_version: ${{ steps.get_version.outputs.package_version }}
67+
is_prerelease: ${{ steps.get_version.outputs.is_prerelease }}
6768
steps:
6869
- name: Checkout repo
6970
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 # zizmor: ignore[artipacked] needs persisted git creds for tag push; no artifact upload here so no leak path
@@ -124,6 +125,12 @@ jobs:
124125
run: |
125126
package_version=$(echo "${STEPS_CHANGESETS_OUTPUTS_PUBLISHEDPACKAGES}" | jq -r '.[0].version')
126127
echo "package_version=${package_version}" >> "$GITHUB_OUTPUT"
128+
# Any semver with a hyphen is a prerelease (e.g. 4.5.0-rc.0, 0.0.0-snapshot-...)
129+
if [[ "${package_version}" == *-* ]]; then
130+
echo "is_prerelease=true" >> "$GITHUB_OUTPUT"
131+
else
132+
echo "is_prerelease=false" >> "$GITHUB_OUTPUT"
133+
fi
127134
env:
128135
STEPS_CHANGESETS_OUTPUTS_PUBLISHEDPACKAGES: ${{ steps.changesets.outputs.publishedPackages }}
129136

@@ -133,13 +140,19 @@ jobs:
133140
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
134141
RELEASE_PR_BODY: ${{ github.event.pull_request.body }}
135142
STEPS_GET_VERSION_OUTPUTS_PACKAGE_VERSION: ${{ steps.get_version.outputs.package_version }}
143+
STEPS_GET_VERSION_OUTPUTS_IS_PRERELEASE: ${{ steps.get_version.outputs.is_prerelease }}
136144
run: |
137145
VERSION="${STEPS_GET_VERSION_OUTPUTS_PACKAGE_VERSION}"
138146
node scripts/generate-github-release.mjs "$VERSION" > /tmp/release-body.md
147+
PRERELEASE_FLAG=""
148+
if [ "${STEPS_GET_VERSION_OUTPUTS_IS_PRERELEASE}" = "true" ]; then
149+
PRERELEASE_FLAG="--prerelease"
150+
fi
139151
gh release create "v${VERSION}" \
140152
--title "trigger.dev v${VERSION}" \
141153
--notes-file /tmp/release-body.md \
142-
--target main
154+
--target main \
155+
$PRERELEASE_FLAG
143156
144157
- name: Create and push Docker tag
145158
if: steps.changesets.outputs.published == 'true'
@@ -239,7 +252,7 @@ jobs:
239252
dispatch-changelog:
240253
name: 📝 Dispatch changelog PR
241254
needs: [release, update-release]
242-
if: needs.release.outputs.published == 'true'
255+
if: needs.release.outputs.published == 'true' && needs.release.outputs.is_prerelease != 'true'
243256
runs-on: ubuntu-latest
244257
permissions: {}
245258
steps:

packages/cli-v3/src/utilities/initialBanner.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import chalk from "chalk";
22
import { getLatestVersion } from "fast-npm-meta";
3+
import * as semver from "semver";
34
import { VERSION } from "../version.js";
45
import { chalkGrey, chalkRun, chalkTask, chalkWorker, logo } from "./cliOutput.js";
56
import { logger } from "./logger.js";
@@ -105,18 +106,16 @@ async function doUpdateCheck(): Promise<string | undefined> {
105106
return;
106107
}
107108

108-
const compareVersions = (a: string, b: string) =>
109-
a.localeCompare(b, "en-US", { numeric: true });
110-
111-
const comparison = compareVersions(VERSION, meta.version);
112-
113-
if (comparison === -1) {
109+
// Use real semver comparison (loose) so prereleases sort correctly against
110+
// their stable counterpart — e.g. a user on `4.5.0-rc.0` sees `4.5.0` as
111+
// newer. String/locale comparison gets this wrong for `X.Y.Z-rc.N` vs `X.Y.Z`.
112+
if (semver.lt(VERSION, meta.version, true)) {
114113
return meta.version;
115114
}
116115

117116
return;
118117
} catch (err) {
119-
// ignore error
118+
// ignore error (covers both network failures and any version-parse oddities)
120119
logger.debug(err);
121120

122121
return;

0 commit comments

Comments
 (0)