Skip to content

Commit bd9b835

Browse files
committed
Setup NPMJS trusted publishers
Also, align the release process of this repo with our other repositories.
1 parent c631256 commit bd9b835

File tree

5 files changed

+18
-96
lines changed

5 files changed

+18
-96
lines changed

.github/workflows/release.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
name: Release
22

33
on:
4-
pull_request:
5-
branches:
6-
- main
7-
types: [closed]
4+
push:
5+
tags:
6+
- v[0-9]+.[0-9]+.[0-9]+
7+
8+
# Getting an ID token is required for NPMJS trusted publishers
9+
permissions:
10+
id-token: write # Required for OIDC
11+
contents: read
812

913
env:
1014
CI: true
1115
jobs:
12-
release-new-version:
13-
if: ${{ github.event.pull_request.merged && startsWith(github.head_ref, 'release/') }}
16+
publish-npm:
1417
runs-on: ubuntu-latest
1518
steps:
1619
- uses: actions/checkout@v5
@@ -19,13 +22,12 @@ jobs:
1922
node-version: 22
2023
cache: npm
2124
registry-url: "https://registry.npmjs.org"
25+
# Ensure npm 11.5.1 or later for trusted publishing
26+
- run: npm install -g npm@latest
2227
- run: npm ci --workspaces
2328
# Running top-level ci should happen after workspaces level, running these
2429
# the other way around results in top-level dependencies (namely, lerna)
2530
# not being installed.
2631
- run: npm ci
2732
- run: npm run build
28-
- run: npm run release
29-
env:
30-
NODE_AUTH_TOKEN: ${{ secrets.INRUPT_NPM_TOKEN }}
31-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
- run: npx lerna publish from-package --yes --no-verify-access

README.md

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,8 @@ This repository contains the following:
1010

1111
First, decide on what type of release to perform, then:
1212

13-
1. Run: `npm run prepare-release`
14-
15-
Follow the prompt and select the type of release:
16-
17-
- Patch (1.0.1)
18-
- Minor (1.1.0)
19-
- Major (2.0.0)
20-
- Prepatch (1.0.1-alpha.0)
21-
- Preminor (1.1.0-alpha.0)
22-
- Premajor (2.0.0-alpha.0)
23-
24-
After confirming, this will update all the `package.json` versions to that new version number,
25-
checkout a new branch `release/<version>` and commit the changed files.
26-
27-
2. Push the branch & create a pull request
28-
29-
3. Merge the pull request, and then let automation do the rest.
13+
1. Switch to a new branch
14+
2. Run `npm run lerna-version -- <major | minor | patch>, and commit the result
15+
3. Push the branch and create a pull request
16+
4. Once approved, merge the pull request and create a GH release with the latest version as a tag.
17+
The tag being pushed will trigger CD.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"clean": "lerna run clean",
1010
"release": "scripts/release.sh",
1111
"test:e2e:browser": "playwright test",
12-
"prepare-release": "scripts/prepare-release.sh",
12+
"lerna-version": "lerna version --no-push --no-git-tag-version",
1313
"lint": "npm run lint:check",
1414
"lint:check": "npm run lint:eslint",
1515
"lint:fix": "npm run lint:eslint -- --fix",

scripts/prepare-release.sh

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

scripts/release.sh

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

0 commit comments

Comments
 (0)