Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(release): use one prerelease rule for GitHub and the image tags
Yudhi Armyndharis1703ba985ba3
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 3aa328d2b..f3dc35603 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -423,7 +423,9 @@ jobs:name: v${{ steps.version.outputs.VERSION }}body: ${{ steps.changelog.outputs.NOTES }}draft: false- prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-alpha') }}+ # Same rule as the image channels below: any tag with a '-' suffix is a prerelease, so a+ # tag kept off X.Y and latest can never become GitHub's "Latest" release either.+ prerelease: ${{ contains(github.ref_name, '-') }}# ──── Docker Image with Version Tag ───────────────────────────────docker:@@ -476,8 +478,9 @@ jobs:docker.io/rmyndharis/openwatags: |type=semver,pattern={{version}}- # The mutable channels (X.Y, latest) are disabled for prereleases: an rc/beta/alpha- # build must never become what `docker pull openwa:0.11` or `:latest` resolves to.+ # The mutable channels (X.Y, latest) are disabled for prereleases, meaning any tag with+ # a '-' suffix (rc, beta, alpha or any other): such a build must never become what+ # `docker pull openwa:0.11` or `:latest` resolves to.# The exact prerelease tag ({{version}}) is still published.type=semver,pattern={{major}}.{{minor}},enable=${{ !contains(github.ref_name, '-') }}type=raw,value=latest,enable=${{ !contains(github.ref_name, '-') }}diff --git a/docs/15-project-roadmap.md b/docs/15-project-roadmap.mdindex 014995a81..dfae56239 100644--- a/docs/15-project-roadmap.md+++ b/docs/15-project-roadmap.md@@ -729,8 +729,8 @@ never points at an image that was not tested. `verify-published` then re-resolvewith no registry login, asserting public pullability and digest identity on both platforms. TheGitHub Release is gated on all of it.-Prereleases (`-rc`, `-beta`, `-alpha` in the tag) skip the mutable `X.Y` and `latest` channels and-are flagged prerelease on GitHub.+A tag with any `-` suffix (for example `-rc.1`, `-beta.1`, `-alpha.1`) is a prerelease: it skips the+mutable `X.Y` and `latest` channels and is flagged prerelease on GitHub.### When a gate failsdiff --git a/src/common/release-gate-parity.spec.ts b/src/common/release-gate-parity.spec.tsindex da344a446..fccbd04c2 100644--- a/src/common/release-gate-parity.spec.ts+++ b/src/common/release-gate-parity.spec.ts@@ -54,3 +54,38 @@ describe('release gate parity (the tag path runs every branch gate)', () => {expect(gateCommands('release.yml', 'test-postgres').join(' ')).toContain('message-list-ordering.pg.spec.ts');});});++/**+ * A tag is a prerelease or it is not, and every release channel has to agree. The image channels+ * (X.Y, latest) and the promote job treat any tag with a '-' suffix as a prerelease; when the+ * GitHub Release matched only -rc/-beta/-alpha, a tag such as v1.2.0-next.1 stayed off `latest` on+ * the registries yet became GitHub's "Latest" release, which is what the in-app update check reads.+ */+describe('one prerelease rule across the GitHub Release and the image channels', () => {+ type ReleaseStep = { uses?: string; run?: string; with?: { prerelease?: string; tags?: string } };+ const PREDICATE = "contains(github.ref_name, '-')";+ const steps = (): ReleaseStep[] => {+ const workflow = yaml.load(fs.readFileSync(path.join(workflowDir, 'release.yml'), 'utf8')) as {+ jobs?: Record<string, { steps?: ReleaseStep[] }>;+ };+ return Object.values(workflow.jobs ?? {}).flatMap(job => job.steps ?? []);+ };++ it('flags the GitHub Release prerelease by the predicate that keeps a tag off X.Y and latest', () => {+ const ghRelease = steps().filter(step => (step.uses ?? '').startsWith('softprops/action-gh-release'));+ expect(ghRelease).toHaveLength(1);+ expect((ghRelease[0].with?.prerelease ?? '').trim()).toBe(`\${{ ${PREDICATE} }}`);++ const tagRules = steps()+ .filter(step => (step.uses ?? '').startsWith('docker/metadata-action'))+ .map(step => step.with?.tags ?? '')+ .join('\n');+ const enables = [...tagRules.matchAll(/enable=\$\{\{\s*(.*?)\s*\}\}/g)].map(match => match[1]);+ // Non-vacuity: the X.Y and latest channels are both gated.+ expect(enables.length).toBeGreaterThanOrEqual(2);+ expect(enables.filter(expr => expr !== `!${PREDICATE}`)).toEqual([]);++ // The promote job's own skip for minor tags uses the same '-' test in bash.+ expect(steps().some(step => /\[\[ "\$REF_NAME" == \*-\* \]\]/.test(step.run ?? ''))).toBe(true);+ });+});