Skip to content

Commit a60e0b3

Browse files
abueideclaude
andauthored
refactor(ci): merge release workflows into single file (#1137)
* refactor(ci): merge release workflows into single file npm trusted publisher only allows one CI file to be configured. Merged release-production.yml, release-beta.yml, and release-dry-run.yml into a single release.yml with a workflow_dispatch type input (dry-run, beta, production). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(ci): enable npm trusted publishing with provenance - Add id-token: write permission for OIDC token exchange - Enable provenance in @semantic-release/npm config - Remove manual npm config set from devbox release script Packages must be configured on npmjs.com to trust the segmentio/analytics-react-native repo and release.yml workflow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(ci): upgrade to @semantic-release/npm v13 for OIDC trusted publishing Upgrade from v11 to v13 which natively supports OIDC trusted publishing. This eliminates the need for NPM_TOKEN entirely - npm auth is handled via short-lived OIDC tokens from the GitHub runner. Removed all NPM_TOKEN and YARN_NPM_AUTH_TOKEN references from the release workflow. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d4bec66 commit a60e0b3

8 files changed

Lines changed: 1634 additions & 166 deletions

File tree

.github/workflows/release-beta.yml

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

.github/workflows/release-dry-run.yml

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

.github/workflows/release-production.yml

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

.github/workflows/release.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
type:
7+
description: 'Release type'
8+
required: true
9+
type: choice
10+
options:
11+
- dry-run
12+
- beta
13+
- production
14+
15+
concurrency:
16+
group: release
17+
cancel-in-progress: true
18+
19+
jobs:
20+
fast-checks:
21+
name: Build + Lint
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
- name: devbox installer
26+
uses: jetify-com/devbox-install-action@v0.14.0
27+
with:
28+
project-path: shells/devbox-fast.json
29+
enable-cache: 'false'
30+
- name: build
31+
run: devbox run --config=shells/devbox-fast.json build
32+
33+
release:
34+
name: Release (${{ inputs.type }})
35+
needs: [fast-checks]
36+
runs-on: ubuntu-latest
37+
environment: ${{ inputs.type != 'dry-run' && 'Publish' || '' }}
38+
permissions:
39+
contents: write
40+
issues: write
41+
pull-requests: write
42+
id-token: write
43+
steps:
44+
- uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
token: ${{ inputs.type != 'dry-run' && secrets.GH_TOKEN || github.token }}
48+
49+
- name: Point beta branch at current commit
50+
if: inputs.type == 'beta'
51+
run: |
52+
git checkout -B beta HEAD
53+
git push origin beta --force
54+
55+
- name: devbox installer
56+
uses: jetify-com/devbox-install-action@v0.14.0
57+
with:
58+
project-path: shells/devbox-fast.json
59+
enable-cache: 'false'
60+
61+
- name: Release (dry-run)
62+
if: inputs.type == 'dry-run'
63+
run: devbox run --config=shells/devbox-fast.json release-dry-run
64+
env:
65+
GH_TOKEN: ${{ github.token }}
66+
67+
- name: Release (beta)
68+
if: inputs.type == 'beta'
69+
run: devbox run --config=shells/devbox-fast.json release
70+
env:
71+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
72+
73+
- name: Release (production)
74+
if: inputs.type == 'production'
75+
run: devbox run --config=shells/devbox-fast.json release
76+
env:
77+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
78+
79+
- name: Update Apps
80+
if: inputs.type == 'production'
81+
run: devbox run --config=shells/devbox-fast.json update-apps

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@semantic-release/commit-analyzer": "^11.1.0",
3838
"@semantic-release/git": "^10.0.1",
3939
"@semantic-release/github": "^9.2.3",
40-
"@semantic-release/npm": "^11.0.1",
40+
"@semantic-release/npm": "^13.1.5",
4141
"@semantic-release/release-notes-generator": "^12.1.0",
4242
"@types/jest": "^29.5.8",
4343
"@types/node": "^20.9.1",

release.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = {
1010
{ preset: 'conventionalcommits' },
1111
],
1212
['@semantic-release/changelog', { changelogFile }],
13-
['@semantic-release/npm', { npmPublish: true }],
13+
['@semantic-release/npm', { npmPublish: true, provenance: true }],
1414
['@semantic-release/github', { successComment: false }],
1515
['@semantic-release/git', { assets: [changelogFile, 'package.json'] }],
1616
],

shells/devbox-fast.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"build": ["bash $SCRIPTS_DIR/build.sh"],
1414
"release": [
1515
"cd \"$PROJECT_ROOT\"",
16-
"npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}",
1716
"yarn install --immutable",
1817
"yarn build",
1918
"yarn multi-semantic-release"

0 commit comments

Comments
 (0)