Skip to content

Commit f51f226

Browse files
authored
automate releases (#3052)
* automate releases Signed-off-by: Matteo Collina <[email protected]> * fixup Signed-off-by: Matteo Collina <[email protected]> * drop publish-undici-types job Signed-off-by: Matteo Collina <[email protected]> * fixup Signed-off-by: Matteo Collina <[email protected]> * fixup Signed-off-by: Matteo Collina <[email protected]> * fixup Signed-off-by: Matteo Collina <[email protected]> * fixup Signed-off-by: Matteo Collina <[email protected]> --------- Signed-off-by: Matteo Collina <[email protected]>
1 parent 502e134 commit f51f226

3 files changed

Lines changed: 92 additions & 26 deletions

File tree

.github/workflows/publish-undici-types.yml

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

.github/workflows/release.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Publish package to npm
2+
3+
permissions:
4+
contents: read
5+
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'The version number to release (has priority over release_type)'
11+
type: string
12+
release_type:
13+
description: Type of release
14+
type: choice
15+
default: patch
16+
options:
17+
- patch
18+
- minor
19+
- major
20+
21+
jobs:
22+
release:
23+
runs-on: ubuntu-latest
24+
25+
permissions:
26+
contents: write
27+
id-token: write
28+
29+
environment: release
30+
31+
outputs:
32+
version: ${{ steps.bump.outputs.version }}
33+
34+
steps:
35+
- uses: actions/checkout@v4
36+
- uses: actions/setup-node@v4
37+
with:
38+
node-version: '20'
39+
registry-url: 'https://registry.npmjs.org'
40+
- run: npm install -g npm@latest
41+
- run: npm install
42+
- name: Git Config
43+
run: |
44+
git config --global user.email "[email protected]"
45+
git config --global user.name "Matteo Collina"
46+
- name: Change version number and push
47+
id: bump
48+
run: |
49+
npm version ${{ inputs.version || inputs.release_type }} --git-tag-version=false
50+
VERSION=`jq -r ".version" package.json`
51+
echo "version=$VERSION" >> $GITHUB_OUTPUT
52+
git add -u
53+
git commit -m "Bumped v$VERSION"
54+
git push origin HEAD:main
55+
- run: npm publish --provenance --access public
56+
env:
57+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
58+
- run: node scripts/generate-undici-types-package-json.js
59+
- run: npm publish --provenance
60+
working-directory: './types'
61+
env:
62+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
63+
64+
releasenotes:
65+
runs-on: ubuntu-latest
66+
needs: release
67+
68+
permissions:
69+
contents: write
70+
71+
env:
72+
VERSION: ${{ needs.release.outputs.version }}
73+
74+
steps:
75+
- uses: actions/checkout@v4
76+
- uses: actions/setup-node@v4
77+
with:
78+
node-version: '20'
79+
registry-url: 'https://registry.npmjs.org'
80+
- name: 'Install release-notes'
81+
run: npm i @matteo.collina/release-notes -g
82+
- name: 'Create release notes'
83+
run: |
84+
NOTES=`release-notes -a ${{ secrets.GITHUB_TOKEN }} -t v$VERSION -r undici -o nodejs`
85+
echo "# Released version $VERSION :rocket:" >> $GITHUB_STEP_SUMMARY
86+
echo "url: $NOTES" >> $GITHUB_STEP_SUMMARY

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* [Lint](#lint)
66
* [Test](#test)
77
* [Coverage](#coverage)
8+
* [Releases](#releases)
89
* [Update `WPTs`](#update-wpts)
910
* [Building for externally shared node builtins](#external-builds)
1011
* [Developer's Certificate of Origin 1.1](#developers-certificate-of-origin)
@@ -166,6 +167,11 @@ npm run test
166167
npm run coverage
167168
```
168169

170+
<a id="releases"></a>
171+
### Issuing Releases
172+
173+
Use the release github action.
174+
169175
<a id="external-builds"></a>
170176
### Building for externally shared node builtins
171177

0 commit comments

Comments
 (0)