Skip to content

Commit 90475cd

Browse files
committed
feat: add GitHub Actions workflow for package publishing and update maintainer instructions for releases
1 parent b05cdd6 commit 90475cd

2 files changed

Lines changed: 63 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Publish Package
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
id-token: write # Required for OIDC
10+
contents: write # Required for creating releases
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v6
17+
18+
- uses: actions/setup-node@v6
19+
with:
20+
node-version: ">=24.13.0" # Required for OIDC, since it only works with NPM 11.5.1 or later
21+
registry-url: "https://registry.npmjs.org"
22+
- run: npm ci
23+
- run: npm -v
24+
- run: npm publish
25+
26+
- name: Get previous tag
27+
id: previoustag
28+
run: |
29+
PREVIOUS_TAG=$(git tag --sort=-v:refname | grep -v "^${GITHUB_REF_NAME}$" | head -n 1)
30+
echo "tag=$PREVIOUS_TAG" >> $GITHUB_OUTPUT
31+
echo "Previous tag: $PREVIOUS_TAG"
32+
33+
- name: Generate changelog
34+
id: changelog
35+
run: |
36+
if [ -z "${{ steps.previoustag.outputs.tag }}" ]; then
37+
CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${GITHUB_REF_NAME})
38+
else
39+
CHANGELOG=$(git log --pretty=format:"- %s (%h)" ${{ steps.previoustag.outputs.tag }}..${GITHUB_REF_NAME})
40+
fi
41+
echo "changelog<<EOF" >> $GITHUB_OUTPUT
42+
echo "$CHANGELOG" >> $GITHUB_OUTPUT
43+
echo "EOF" >> $GITHUB_OUTPUT
44+
45+
- name: Create GitHub Release
46+
uses: actions/create-release@v1
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
with:
50+
tag_name: ${{ github.ref_name }}
51+
release_name: Release ${{ github.ref_name }}
52+
body: |
53+
## Changes since ${{ steps.previoustag.outputs.tag || 'beginning' }}
54+
55+
${{ steps.changelog.outputs.changelog }}
56+
draft: false
57+
prerelease: false

README_FOR_MAINTAINERS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Create new release
2+
3+
```
4+
npm version patch # or minor / major
5+
git push --follow-tags
6+
```

0 commit comments

Comments
 (0)