Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automate releases #3052

Merged
merged 7 commits into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions .github/workflows/publish-undici-types.yml

This file was deleted.

86 changes: 86 additions & 0 deletions .github/workflows/release.yml
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
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* [Lint](#lint)
* [Test](#test)
* [Coverage](#coverage)
* [Releases](#releases)
* [Update `WPTs`](#update-wpts)
* [Building for externally shared node builtins](#external-builds)
* [Developer's Certificate of Origin 1.1](#developers-certificate-of-origin)
Expand Down Expand Up @@ -166,6 +167,11 @@ npm run test
npm run coverage
```

<a id="releases"></a>
### Issuing Releases

Use the release github action.

<a id="external-builds"></a>
### Building for externally shared node builtins

Expand Down
Loading