-
Notifications
You must be signed in to change notification settings - Fork 546
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* automate releases Signed-off-by: Matteo Collina <hello@matteocollina.com> * fixup Signed-off-by: Matteo Collina <hello@matteocollina.com> * drop publish-undici-types job Signed-off-by: Matteo Collina <hello@matteocollina.com> * fixup Signed-off-by: Matteo Collina <hello@matteocollina.com> * fixup Signed-off-by: Matteo Collina <hello@matteocollina.com> * fixup Signed-off-by: Matteo Collina <hello@matteocollina.com> * fixup Signed-off-by: Matteo Collina <hello@matteocollina.com> --------- Signed-off-by: Matteo Collina <hello@matteocollina.com>
- Loading branch information
Showing
3 changed files
with
92 additions
and
26 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Publish package to npm | ||
|
||
permissions: | ||
contents: read | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'The version number to release (has priority over release_type)' | ||
type: string | ||
release_type: | ||
description: Type of release | ||
type: choice | ||
default: patch | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
|
||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: write | ||
id-token: write | ||
|
||
environment: release | ||
|
||
outputs: | ||
version: ${{ steps.bump.outputs.version }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://registry.npmjs.org' | ||
- run: npm install -g npm@latest | ||
- run: npm install | ||
- name: Git Config | ||
run: | | ||
git config --global user.email "hello@matteocollina.com" | ||
git config --global user.name "Matteo Collina" | ||
- name: Change version number and push | ||
id: bump | ||
run: | | ||
npm version ${{ inputs.version || inputs.release_type }} --git-tag-version=false | ||
VERSION=`jq -r ".version" package.json` | ||
echo "version=$VERSION" >> $GITHUB_OUTPUT | ||
git add -u | ||
git commit -m "Bumped v$VERSION" | ||
git push origin HEAD:main | ||
- run: npm publish --provenance --access public | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- run: node scripts/generate-undici-types-package-json.js | ||
- run: npm publish --provenance | ||
working-directory: './types' | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
releasenotes: | ||
runs-on: ubuntu-latest | ||
needs: release | ||
|
||
permissions: | ||
contents: write | ||
|
||
env: | ||
VERSION: ${{ needs.release.outputs.version }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: 'Install release-notes' | ||
run: npm i @matteo.collina/release-notes -g | ||
- name: 'Create release notes' | ||
run: | | ||
NOTES=`release-notes -a ${{ secrets.GITHUB_TOKEN }} -t v$VERSION -r undici -o nodejs` | ||
echo "# Released version $VERSION :rocket:" >> $GITHUB_STEP_SUMMARY | ||
echo "url: $NOTES" >> $GITHUB_STEP_SUMMARY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters