File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 1+ # Create new release
2+
3+ ```
4+ npm version patch # or minor / major
5+ git push --follow-tags
6+ ```
You can’t perform that action at this time.
0 commit comments