Skip to content

Commit 059d9ed

Browse files
authored
chore(infra): enable npm trusted publishing and refactor release pipeline (#19)
1 parent 3fd88b9 commit 059d9ed

File tree

3 files changed

+28
-137
lines changed

3 files changed

+28
-137
lines changed

.github/workflows/release.yml

Lines changed: 26 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,47 @@
1-
name: Release Full
1+
# This action will publish the package to npm and create a GitHub release.
2+
name: Release
23

34
on:
4-
workflow_dispatch:
5-
inputs:
6-
version:
7-
type: choice
8-
description: "Release Version Type"
9-
required: true
10-
default: "patch"
11-
options:
12-
- major
13-
- premajor
14-
- minor
15-
- preminor
16-
- patch
17-
- prepatch
18-
- prerelease
19-
20-
tag:
21-
type: choice
22-
description: "Release Npm Tag"
23-
required: true
24-
default: "latest"
25-
options:
26-
- canary
27-
- nightly
28-
- latest
29-
- beta
30-
- alpha
5+
# Run `npm run bump` to bump the version and create a git tag.
6+
push:
7+
tags:
8+
- 'v*'
319

32-
dry_run:
33-
type: boolean
34-
description: "DryRun release"
35-
required: true
36-
default: false
10+
workflow_dispatch:
3711

3812
permissions:
39-
# To publish packages with provenance
13+
contents: write
4014
id-token: write
4115

4216
jobs:
43-
release:
44-
name: Release
45-
permissions:
46-
contents: write
47-
# To publish packages with provenance
48-
id-token: write
17+
publish:
4918
runs-on: ubuntu-latest
50-
19+
environment: npm
5120
steps:
5221
- name: Checkout
5322
uses: actions/checkout@v4
5423

55-
- name: Install Pnpm
56-
run: corepack enable
57-
5824
- name: Setup Node.js
5925
uses: actions/setup-node@v4
6026
with:
61-
node-version: 20
62-
cache: "pnpm"
27+
node-version: 22
28+
29+
- name: Setup Package Managers
30+
run: |
31+
npm install -g npm@latest
32+
npm --version
33+
npm install -g corepack@latest --force
34+
corepack enable
6335
6436
- name: Install Dependencies
6537
run: pnpm install
6638

67-
- name: Run Test
68-
run: pnpm run test
39+
- name: Publish
40+
uses: JS-DevTools/npm-publish@v3
41+
with:
42+
token: empty
6943

70-
- name: Try release to npm
71-
run: pnpm run release
72-
env:
73-
DRY_RUN: ${{ inputs.dry_run }}
74-
TAG: ${{ inputs.tag }}
75-
VERSION: ${{ inputs.version }}
76-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
44+
- name: Create GitHub Release
45+
uses: ncipollo/release-action@v1
46+
with:
47+
generateReleaseNotes: 'true'

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "path-serializer",
33
"version": "0.5.0",
44
"description": "path-serializer",
5-
"keywords": ["snapshot", "vitest", "jest", "ci", "test"],
5+
"keywords": ["snapshot", "rstest", "vitest", "jest", "ci", "test"],
66
"repository": {
77
"type": "git",
88
"url": "https://github.com/rspack-contrib/path-serializer.git"
@@ -29,7 +29,7 @@
2929
"test:watch": "vitest",
3030
"test": "vitest run",
3131
"prepublish": "pnpm run build",
32-
"release": "node ./scripts/release.mjs"
32+
"bump": "npx bumpp"
3333
},
3434
"simple-git-hooks": {
3535
"pre-commit": "npx nano-staged"

scripts/release.mjs

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

0 commit comments

Comments
 (0)