Skip to content

Commit 53d7d93

Browse files
Bring back next tag on sdk publication (#517)
### Proposed Changes * change 1 * change 2 ### Checklist - [ ] Tests - [ ] Translations - [ ] Security Implications Contemplated (add notes if applicable) ### Additional Info ** any additional useful context or info ** ### Screenshots Original | Updated :-------------------------:|:-------------------------: ** original screenshot ** | ** updated screenshot ** fixes #515 --------- Co-authored-by: Kevin <kfariid@gmail.com>
1 parent b0cbb68 commit 53d7d93

3 files changed

Lines changed: 96 additions & 9 deletions

File tree

.github/actions/core-cicd/deployment/deploy-javascript-sdk/action.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@
22
#
33
# VERSIONING (ADR-0019 — date-lockstep versioning):
44
# - The SDK version is always the dotCMS release version it ships with. There is no
5-
# independent SDK versioning and no `@next` prerelease channel.
5+
# independent SDK versioning.
66
# - Single source of truth: the `version` input, supplied by the caller (the dotCMS
77
# release pipeline — see cicd_release-sdk.yml, which derives it from the GitHub
88
# Release tag, mirroring how cicd_release-cli.yml versions @dotcms/dotcli).
9-
# - Every invocation publishes every SDK package at that exact version to the `latest`
10-
# npm dist-tag — including releases where the SDK has no code changes, to preserve
11-
# the one-dotCMS-version <-> one-SDK-version invariant.
9+
# - Every real-release invocation publishes every SDK package at that exact version to
10+
# the `latest` npm dist-tag — including releases where the SDK has no code changes, to
11+
# preserve the one-dotCMS-version <-> one-SDK-version invariant.
12+
#
13+
# `next` TAG (internal dev/QA use only):
14+
# - cicd_3-trunk.yml also calls this action on merges to main that touch SDK files,
15+
# passing npm-tag: 'next' and a version computed from the current `latest` plus a
16+
# `-next.<run_number>` suffix. This is never a date-lockstep-shaped version and must
17+
# never be recommended to customers — see issue #36701.
1218
#
1319
name: 'SDK Publish NPM Packages - Stable'
14-
description: 'Publish the dotCMS SDK libs on NPM registry at the given version.'
20+
description: 'Publish the dotCMS SDK libs on NPM registry at the given version and dist-tag.'
1521
inputs:
1622
ref:
1723
description: 'Branch/tag to build from'
@@ -20,6 +26,10 @@ inputs:
2026
version:
2127
description: 'Exact version to publish every @dotcms/* SDK package at (e.g. 26.7.14-1)'
2228
required: true
29+
npm-tag:
30+
description: 'npm dist-tag to publish under (e.g. latest, next)'
31+
required: false
32+
default: 'latest'
2333
npm-token:
2434
description: 'NPM token'
2535
required: true
@@ -150,10 +160,12 @@ runs:
150160
env:
151161
RELEASE_VERSION: ${{ inputs.version }}
152162
NPM_AUTH_TOKEN: ${{ inputs.npm-token }}
163+
NPM_TAG: ${{ inputs.npm-tag }}
153164
run: |
154165
set -euo pipefail
155166
echo "::group::Publishing SDK packages"
156167
echo "Version: $RELEASE_VERSION"
168+
echo "Tag: $NPM_TAG"
157169
echo ""
158170
159171
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > ~/.npmrc
@@ -164,8 +176,8 @@ runs:
164176
echo "📦 Processing @dotcms/${sdk}..."
165177
cd "$sdk"
166178
167-
echo " 🚀 Publishing: @dotcms/${sdk}@${RELEASE_VERSION}"
168-
if npm publish --access public --tag latest; then
179+
echo " 🚀 Publishing: @dotcms/${sdk}@${RELEASE_VERSION} (tag: ${NPM_TAG})"
180+
if npm publish --access public --tag "${NPM_TAG}"; then
169181
echo " ✅ Published"
170182
else
171183
echo " ❌ Failed to publish"

.github/workflows/cicd_3-trunk.yml

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,86 @@ jobs:
125125
NPM_ORG_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
126126
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
127127

128+
# Publish SDK packages to the `next` npm dist-tag — internal dev/QA use only, never
129+
# date-lockstep-shaped, never recommended to customers (see issue #36701). Kept as its
130+
# own job (not folded into cicd_comp_deployment-phase.yml) so this trunk-only concern
131+
# can't affect nightly/manual/release, which don't opt into it.
132+
#
133+
# Version = the currently-published `latest` npm version, plus a `-next.<run_number>`
134+
# suffix — computed live on every run, no local VERSION file. Gated on the existing
135+
# sdk_libs change-detection filter (only publish when SDK files actually changed) and
136+
# skipped for manual workflow_dispatch runs.
137+
publish-sdk-next:
138+
name: Publish SDK (next)
139+
needs: [ initialize, test ]
140+
# Explicit success check on `test` (not the always()/!failure() idiom used by
141+
# sibling jobs) — this job publishes to a real, public npm registry, so it should
142+
# require `test` to have actually run and passed, not merely "didn't fail/wasn't
143+
# cancelled" (which also admits a skipped test job).
144+
if: >-
145+
needs.test.result == 'success' &&
146+
fromJSON(needs.initialize.outputs.filters).sdk_libs == 'true' &&
147+
github.event_name != 'workflow_dispatch'
148+
runs-on: ubuntu-${{ vars.UBUNTU_RUNNER_VERSION || '24.04' }}
149+
steps:
150+
- name: 'Compute next version'
151+
id: next-version
152+
env:
153+
NPM_AUTH_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
154+
run: |
155+
set -euo pipefail
156+
echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > ~/.npmrc
157+
158+
LATEST_VERSION=$(npm view @dotcms/client version)
159+
NEXT_VERSION="${LATEST_VERSION}-next.${{ github.run_number }}"
160+
161+
echo "::notice:: Currently published latest version: $LATEST_VERSION"
162+
echo "::notice:: Publishing next version: $NEXT_VERSION"
163+
164+
echo "version=$NEXT_VERSION" >> "$GITHUB_OUTPUT"
165+
166+
- name: 'Publish SDK packages to NPM (next)'
167+
id: deploy-javascript-sdk
168+
uses: ./.github/actions/core-cicd/deployment/deploy-javascript-sdk
169+
with:
170+
ref: ${{ github.sha }}
171+
version: ${{ steps.next-version.outputs.version }}
172+
npm-tag: next
173+
npm-token: ${{ secrets.NPM_ORG_TOKEN }}
174+
github-token: ${{ secrets.GITHUB_TOKEN }}
175+
176+
- name: 'Slack Notification (SDK next announcement)'
177+
if: success() && steps.deploy-javascript-sdk.outputs.published == 'true'
178+
continue-on-error: true
179+
uses: ./.github/actions/core-cicd/notification/notify-slack
180+
with:
181+
channel-id: "log-sdk-libs"
182+
payload: |
183+
> :large_orange_circle: *Attention dotters:* SDK libs published to `next`!
184+
>
185+
> This automated script is happy to announce that a new *_SDK libs_* version *tagged as:* [ `${{ steps.next-version.outputs.version }}` ] is now available on the `NPM` registry under the `next` tag :package:. This is an internal dev/QA build, not an official release — do not recommend it to customers.
186+
> `npm install @dotcms/client@next`
187+
> <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|View commit> · <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow run>
188+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
189+
190+
- name: 'Slack Notification (SDK next failure)'
191+
if: failure()
192+
continue-on-error: true
193+
uses: ./.github/actions/core-cicd/notification/notify-slack
194+
with:
195+
channel-id: "log-sdk-libs"
196+
payload: |
197+
> :red_circle: *SDK `next` publish FAILED!*
198+
>
199+
> The automated SDK `next` publish failed while trying to publish version `${{ steps.next-version.outputs.version }}`.
200+
> <${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}|View commit> · <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View workflow run — check logs for details>
201+
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
202+
128203
# Finalize job - aggregates results from previous jobs
129204
finalize:
130205
name: Finalize
131206
if: always()
132-
needs: [ initialize, build, build-cli, test, deployment]
207+
needs: [ initialize, build, build-cli, test, deployment, publish-sdk-next ]
133208
uses: ./.github/workflows/cicd_comp_finalize-phase.yml
134209
with:
135210
artifact-run-id: ${{ needs.initialize.outputs.artifact-run-id }}

core-web/libs/sdk/ai/scripts/generate-spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ const EXCLUDED_PATTERNS = [
5858
];
5959

6060
const DEFAULT_SPEC_PATH = '/api/openapi.json';
61-
const DEFAULT_SPEC_URL = `https://corpsites-headless.dotcms.cloud${DEFAULT_SPEC_PATH}`;
61+
const DEFAULT_SPEC_URL = `https://dotcms-corp-headless-prod.dotcms.dev${DEFAULT_SPEC_PATH}`;
6262

6363
/**
6464
* Matches a path against a pattern. Pattern syntax:

0 commit comments

Comments
 (0)