Skip to content

Commit 9ccff5d

Browse files
ci(release): remove semantic-release and replace with explicit versioned workflow steps
Removes release.config.js entirely. All responsibilities previously owned by semantic-release are now explicit, named steps in both staging-step-1.yml and release.yml: - Version determination: a new bump_type input (major/minor/patch) on workflow_dispatch drives `npm version $bump_type --no-git-tag-version`, which bumps package.json and package-lock.json and surfaces the new version to all downstream steps via steps.get-version.outputs.version. - npm publish: explicit `npm publish` step (OIDC unchanged). - GitHub release: `gh release create` step with the same dist assets that @semantic-release/github was uploading. - Git commit + tag: explicit `git commit` and `git tag` steps; tag is pushed alongside the release branch in the final push step. The semantic-release-only job-level env block (GITHUB_TOKEN, GIT_AUTHOR_*, GIT_COMMITTER_*) is removed from both workflows; git identity is already set by the Import GPG Key step. release.yml permissions are updated from contents:read to contents:write to allow pushing the tag. Deferred: CHANGELOG.md auto-generation (was @semantic-release/changelog). Refs #1210 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ecad31d commit 9ccff5d

3 files changed

Lines changed: 87 additions & 101 deletions

File tree

.github/workflows/release.yml

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ on:
88
required: true
99
type: boolean
1010
default: true
11+
bump_type:
12+
description: 'Version bump type'
13+
required: true
14+
type: choice
15+
options:
16+
- patch
17+
- minor
18+
- major
19+
default: patch
1120

1221
jobs:
1322
# SDK release is done from master branch.
@@ -243,14 +252,7 @@ jobs:
243252
# OIDC permissions for npm trusted publishing
244253
permissions:
245254
id-token: write
246-
contents: read
247-
248-
env:
249-
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
250-
GIT_AUTHOR_NAME: mparticle-automation
251-
GIT_AUTHOR_EMAIL: developers@mparticle.com
252-
GIT_COMMITTER_NAME: mparticle-automation
253-
GIT_COMMITTER_EMAIL: developers@mparticle.com
255+
contents: write
254256

255257
steps:
256258
- name: Checkout public master branch
@@ -280,16 +282,44 @@ jobs:
280282
- name: Install dependencies
281283
run: npm ci
282284

283-
- name: Release --dry-run
284-
if: ${{ github.event.inputs.dryRun == 'true'}}
285+
- name: Calculate next version
286+
id: get-version
285287
run: |
286-
npx semantic-release --dry-run
288+
NEXT_VERSION=$(npm version ${{ github.event.inputs.bump_type }} --no-git-tag-version)
289+
NEXT_VERSION=${NEXT_VERSION#v}
290+
if [ -z "$NEXT_VERSION" ]; then
291+
echo "ERROR: Failed to calculate next version"
292+
exit 1
293+
fi
294+
echo "version=$NEXT_VERSION" >> "$GITHUB_OUTPUT"
295+
echo "Next version: $NEXT_VERSION"
296+
297+
- name: Commit package.json version bump
298+
if: ${{ github.event.inputs.dryRun == 'false' }}
299+
run: |
300+
git add package.json package-lock.json
301+
git commit -m "chore(release): ${{ steps.get-version.outputs.version }} [skip ci]"
287302
288-
# NPM Publish happens here via OIDC trusted publishing
289-
- name: Release
290-
if: ${{ github.event.inputs.dryRun == 'false'}}
303+
- name: Create release tag
304+
if: ${{ github.event.inputs.dryRun == 'false' }}
305+
run: git tag v${{ steps.get-version.outputs.version }}
306+
307+
- name: Publish SDK to npm
308+
if: ${{ github.event.inputs.dryRun == 'false' }}
309+
run: npm publish
310+
311+
- name: Create GitHub release
312+
if: ${{ github.event.inputs.dryRun == 'false' }}
313+
env:
314+
GH_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
291315
run: |
292-
npx semantic-release
316+
gh release create v${{ steps.get-version.outputs.version }} \
317+
--title "v${{ steps.get-version.outputs.version }}" \
318+
dist/mparticle.common.js \
319+
dist/mparticle.esm.js \
320+
dist/mparticle.js \
321+
snippet.js \
322+
snippet.min.js
293323
294324
- name: Archive npm failure logs
295325
uses: actions/upload-artifact@v6
@@ -298,10 +328,11 @@ jobs:
298328
name: npm-logs
299329
path: ~/.npm/_logs
300330

301-
- name: Push automated release commits to release branch
331+
- name: Push release commits and tag to release branch
302332
if: ${{ github.event.inputs.dryRun == 'false' }}
303333
run: |
304334
git push origin HEAD:release/${{ github.run_number }}
335+
git push origin v${{ steps.get-version.outputs.version }}
305336
306337
sync-repository:
307338
name: Sync repositories

.github/workflows/staging-step-1.yml

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ on:
88
required: true
99
type: boolean
1010
default: true
11+
bump_type:
12+
description: 'Version bump type'
13+
required: true
14+
type: choice
15+
options:
16+
- patch
17+
- minor
18+
- major
19+
default: patch
1120

1221
jobs:
1322
# SDK staging release must be done from the staging branch
@@ -315,13 +324,6 @@ jobs:
315324
pull-requests: write
316325
id-token: write
317326

318-
env:
319-
GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
320-
GIT_AUTHOR_NAME: mparticle-automation
321-
GIT_AUTHOR_EMAIL: developers@mparticle.com
322-
GIT_COMMITTER_NAME: mparticle-automation
323-
GIT_COMMITTER_EMAIL: developers@mparticle.com
324-
325327
steps:
326328
- name: Checkout staging branch
327329
uses: actions/checkout@v6
@@ -353,18 +355,17 @@ jobs:
353355
- name: Verify npm version
354356
run: npm --version
355357

356-
# Always dry-run first to determine the next version and validate
357-
# the release config before making any permanent changes.
358-
- name: Release --dry-run (determine version)
358+
- name: Calculate next version
359359
id: get-version
360360
run: |
361-
npx semantic-release --branches staging --dry-run 2>&1 | tee /tmp/sr-output.txt
362-
NEXT_VERSION=$(grep -oP '(?<=The next release version is )\S+' /tmp/sr-output.txt)
361+
NEXT_VERSION=$(npm version ${{ github.event.inputs.bump_type }} --no-git-tag-version)
362+
NEXT_VERSION=${NEXT_VERSION#v}
363363
if [ -z "$NEXT_VERSION" ]; then
364-
echo "ERROR: Failed to parse next release version from semantic-release output"
364+
echo "ERROR: Failed to calculate next version"
365365
exit 1
366366
fi
367367
echo "version=$NEXT_VERSION" >> "$GITHUB_OUTPUT"
368+
echo "Next version: $NEXT_VERSION"
368369
369370
- name: Build distribution bundle
370371
if: ${{ github.event.inputs.dryRun == 'false' }}
@@ -384,10 +385,32 @@ jobs:
384385
git add kits/
385386
git commit -m "chore(release): Update kit versions to $VERSION [skip ci]"
386387
387-
- name: Release
388+
- name: Commit package.json version bump
389+
if: ${{ github.event.inputs.dryRun == 'false' }}
390+
run: |
391+
git add package.json package-lock.json
392+
git commit -m "chore(release): ${{ steps.get-version.outputs.version }} [skip ci]"
393+
394+
- name: Create release tag
395+
if: ${{ github.event.inputs.dryRun == 'false' }}
396+
run: git tag v${{ steps.get-version.outputs.version }}
397+
398+
- name: Publish SDK to npm
399+
if: ${{ github.event.inputs.dryRun == 'false' }}
400+
run: npm publish
401+
402+
- name: Create GitHub release
388403
if: ${{ github.event.inputs.dryRun == 'false' }}
404+
env:
405+
GH_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }}
389406
run: |
390-
npx semantic-release --branches staging
407+
gh release create v${{ steps.get-version.outputs.version }} \
408+
--title "v${{ steps.get-version.outputs.version }}" \
409+
dist/mparticle.common.js \
410+
dist/mparticle.esm.js \
411+
dist/mparticle.js \
412+
snippet.js \
413+
snippet.min.js
391414
392415
- name: Archive npm failure logs
393416
uses: actions/upload-artifact@v6
@@ -396,10 +419,11 @@ jobs:
396419
name: npm-logs-release
397420
path: ~/.npm/_logs
398421

399-
- name: Push automated release commits to release branch
422+
- name: Push release commits and tag to release branch
400423
if: ${{ github.event.inputs.dryRun == 'false' }}
401424
run: |
402425
git push origin HEAD:release/${{ github.run_number }}
426+
git push origin v${{ steps.get-version.outputs.version }}
403427
404428
release-kits:
405429
name: 'Publish Kit: ${{ matrix.kit.name }}'

release.config.js

Lines changed: 0 additions & 69 deletions
This file was deleted.

0 commit comments

Comments
 (0)