-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,25 +40,23 @@ jobs: | |
uses: tyankatsu0105/read-package-version-actions@v1 | ||
id: package-version | ||
|
||
- name: 创建 tag | ||
run: git tag v${{ steps.package-version.outputs.version }} | ||
# 判断 version 是否已存在 | ||
if: contains(github.ref, 'refs/tags/v${{ steps.package-version.outputs.version }}') == false | ||
# 暂存 contains(github.ref, 'refs/tags/v${{ steps.package-version.outputs.version }}') 结果 | ||
- name: 判断 tag 是否存在 | ||
id: tag-exists | ||
run: echo ::set-output name=tag-exists::$(contains(github.ref, 'refs/tags/v${{ steps.package-version.outputs.version }}')) | ||
|
||
- name: 推送 tag | ||
uses: ad-m/[email protected] | ||
if: contains(github.ref, 'refs/tags/v${{ steps.package-version.outputs.version }}') == false | ||
- name: 发布 Release | ||
uses: softprops/action-gh-release@v2 | ||
if: steps.tag-exists.outputs.tag-exists == 'false' | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
tags: v${{ steps.package-version.outputs.version }} | ||
name: v${{ steps.package-version.outputs.version }} | ||
tag_name: v${{ steps.package-version.outputs.version }} | ||
|
||
- name: 发布到 NPM | ||
# 根据 version 判断是否需要加 --tag [alpha|beta] | ||
run: npm publish --tag ${{ contains(steps.package-version.outputs.version, 'alpha') && 'alpha' || contains(steps.package-version.outputs.version, 'beta') && 'beta' || 'latest' }} | ||
if: steps.tag-exists.outputs.tag-exists == 'false' | ||
|
||
- name: 发布 Release | ||
uses: softprops/action-gh-release@v2 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
name: v${{ steps.package-version.outputs.version }} | ||
tag_name: v${{ steps.package-version.outputs.version }} | ||
- name: 创建 tag | ||
run: git tag v${{ steps.package-version.outputs.version }} && git push --tags | ||
if: steps.tag-exists.outputs.tag-exists == 'false' |