Skip to content

Commit

Permalink
feat: 添加自动发布tag的能力
Browse files Browse the repository at this point in the history
  • Loading branch information
nashaofu committed Aug 11, 2024
1 parent 056574d commit a8d8157
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
20 changes: 20 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
categories:
- title: "🚀 Features"
labels:
- "feature"
- "enhancement"
- title: "🐛 Bug Fixes"
labels:
- "fix"
- "bugfix"
- "bug"
- title: "🧰 Maintenance"
label: "chore"
change-template: "- $TITLE @$AUTHOR (#$NUMBER)"
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
template: |
## Changes
$CHANGES
**Full Changelog**: https://github.com/$OWNER/$REPOSITORY/compare/$PREVIOUS_TAG...v$RESOLVED_VERSION
30 changes: 19 additions & 11 deletions .github/workflows/napi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ on:
push:
branches:
- master
tags-ignore:
- "**"
tags:
- v*.*.*
paths-ignore:
- "**/*.md"
- LICENSE
- "**/*.gitignore"
- .editorconfig
- docs/**
pull_request: null
pull_request:
branches:
- master

permissions:
contents: write
Expand Down Expand Up @@ -277,6 +279,7 @@ jobs:
publish:
name: Publish
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
needs:
- test-macOS-windows-binding
- test-linux-x64-gnu-binding
Expand All @@ -303,17 +306,22 @@ jobs:
- name: Publish
run: |
npm config set provenance true
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
if [ -z "$PUBLISH_NEXT" ]; then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >>~/.npmrc
npm publish --access public
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
npm publish --tag next --access public
else
echo "Not a release, skipping publish"
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >>~/.npmrc
npm publish --access public --tag next
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
PUBLISH_NEXT: ${{ endsWith(github.ref_name, '-next') }}
- name: Release drafter
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
publish: true
name: ${{ github.ref_name }}
tag: ${{ github.ref_name }}

0 comments on commit a8d8157

Please sign in to comment.