File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77
88jobs :
99 release :
10- uses : sxzz/workflows/.github/workflows/release.yml@v1
11- with :
12- publish : true
10+ name : Release
11+ runs-on : ubuntu-latest
12+
1313 permissions :
1414 contents : write
1515 id-token : write
16+
17+ steps :
18+ - name : Setup JS
19+ uses : sxzz/workflows/setup-js@v1
20+ with :
21+ fetch-all : true
22+
23+ - name : Generate GitHub Changelog
24+ run : pnpx changelogithub
25+ continue-on-error : true
26+ env :
27+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
28+
29+ - name : Detect Version Type
30+ id : detect_version
31+ run : |
32+ VERSION=$(node -p "require('./package.json').version")
33+ if [[ "$VERSION" =~ -[a-zA-Z] ]]; then
34+ echo "is_prerelease=true" >> $GITHUB_OUTPUT
35+ if [[ "$VERSION" =~ -beta ]]; then
36+ echo "tag=beta" >> $GITHUB_OUTPUT
37+ elif [[ "$VERSION" =~ -alpha ]]; then
38+ echo "tag=alpha" >> $GITHUB_OUTPUT
39+ elif [[ "$VERSION" =~ -rc ]]; then
40+ echo "tag=rc" >> $GITHUB_OUTPUT
41+ else
42+ echo "tag=next" >> $GITHUB_OUTPUT
43+ fi
44+ else
45+ echo "is_prerelease=false" >> $GITHUB_OUTPUT
46+ echo "tag=latest" >> $GITHUB_OUTPUT
47+ fi
48+ echo "Version: $VERSION"
49+
50+ - name : Display Version Info
51+ run : |
52+ echo "Version: $(node -p "require('./package.json').version")"
53+ echo "Is Prerelease: ${{ steps.detect_version.outputs.is_prerelease }}"
54+ echo "Tag: ${{ steps.detect_version.outputs.tag }}"
55+
56+ - name : Publish to NPM
57+ run : pnpm publish --access public --no-git-checks --tag ${{ steps.detect_version.outputs.tag }}
You can’t perform that action at this time.
0 commit comments