Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
Signed-off-by: Matteo Collina <hello@matteocollina.com>
  • Loading branch information
mcollina committed Apr 6, 2024
1 parent d210d1c commit 7ec181e
Showing 1 changed file with 48 additions and 17 deletions.
65 changes: 48 additions & 17 deletions .github/workflows/release.yml
@@ -1,45 +1,76 @@
name: Release to npm
name: Publish package to npm

on:
workflow_dispatch:
inputs:
version:
description: 'The version number to tag and release'
required: true
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:
build:
release:
runs-on: ubuntu-latest

environment: release
permissions:
contents: write
id-token: write

outputs:
version: ${{ steps.bump.outputs.version }}

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- 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: Change version number and push
- name: Git Config
run: |
git config --global user.email "hello@matteocollina.com"
git config --global user.name "Matteo Collina"
npm version ${{ inputs.version }} --git-tag-version=false
- 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
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- run: node scripts/generate-undici-types-package-json.js
- run: npm publish --provenance
working-directory: './types'
- run: npm publish --provenance --access public
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: |
npm i @matteo.collina/release-notes -g
release-notes -a ${{ secrets.GITHUB_TOKEN }} -t ${{ inputs.version }} -r undici -o nodejs
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

0 comments on commit 7ec181e

Please sign in to comment.