9
9
pull_request :
10
10
branches : [main]
11
11
workflow_dispatch :
12
+ inputs :
13
+ version :
14
+ description : " Version type (auto-detects from package.json if not specified)"
15
+ required : false
16
+ type : choice
17
+ options :
18
+ - " "
19
+ - patch
20
+ - minor
21
+ - major
12
22
13
23
jobs :
14
24
lint :
@@ -46,21 +56,21 @@ jobs:
46
56
needs : [lint, build]
47
57
if : ${{ github.event_name == 'workflow_dispatch' }}
48
58
permissions :
49
- contents : write
50
- packages : write
59
+ id-token : write # Required for OIDC
60
+ contents : write # Required for release-it to create tags/commits
51
61
steps :
52
62
- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
53
63
with :
54
- # Fetch all history for proper versioning
55
- fetch-depth : 0
64
+ fetch-depth : 0 # Need full history for release-it
56
65
57
- - name : Use Node.js 20
58
- uses : actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
66
+ # setup-node with registry-url is required for OIDC trusted publishing
67
+ - uses : actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
59
68
with :
60
- node-version : " 20"
69
+ node-version : 20
70
+ cache : " npm"
61
71
registry-url : " https://registry.npmjs.org"
62
72
63
- - name : Setup SSH Bot
73
+ - name : Set up SSH signing
64
74
uses : photostructure/git-ssh-signing-action@a770c2ff3aea31d9df9f2974ac9d672f2bfe62f3 # v1.1.0
65
75
with :
66
76
ssh-signing-key : ${{ secrets.SSH_SIGNING_KEY }}
@@ -70,30 +80,10 @@ jobs:
70
80
- name : Install dependencies
71
81
run : npm ci
72
82
73
- - name : Build and test
74
- run : npm test
75
-
76
- - name : Create release
77
- run : |
78
- # Bump version and create signed commit and tag
79
- npm version patch -m "release: %s"
80
-
81
- # Push the version commit and tag
82
- git push --follow-tags
83
-
84
- - name : Publish to npm
85
- run : npm publish
86
- env :
87
- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
88
-
89
- - name : Create GitHub release
90
- run : |
91
- # Get the version from package.json
92
- VERSION=$(node -p "require('./package.json').version")
93
-
94
- # Create GitHub release
95
- gh release create "v${VERSION}" \
96
- --title "Release v${VERSION}" \
97
- --generate-notes
83
+ # Note: Tests are run by release-it's before:init hook via npm run lint -> pretest
84
+ # This avoids running the full test matrix (9+ OS/Node combinations) in the release workflow
85
+ # The pretest script (clean + lint + compile) is sufficient for release validation
86
+ - name : Release with release-it
87
+ run : npm run release -- --ci ${{ github.event.inputs.version }}
98
88
env :
99
- GH_TOKEN : ${{ github.token }}
89
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments