Skip to content

Commit

Permalink
🐎 ci: release workflow test
Browse files Browse the repository at this point in the history
  • Loading branch information
kiccer committed Apr 7, 2024
1 parent b401e3a commit f3465e0
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions .github/workflows/master_push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,29 +42,24 @@ jobs:

# 暂存 contains(github.ref, 'refs/tags/v${{ steps.package-version.outputs.version }}') 结果
- name: 判断 tag 是否存在
# id: tag-exists
# run: echo ::set-output name=hasTag::${{ contains(github.ref, 'refs/tags/v${{ steps.package-version.outputs.version }}') }}
uses: mukunku/tag-exists-action@v1.6.0
id: check-tag
run: |
if git rev-parse "v${{ steps.package-version.outputs.version }}" >/dev/null 2>&1; then
echo "::set-output name=exists::true"
else
echo "::set-output name=exists::false"
fi
with:
tag: v${{ steps.package-version.outputs.version }}

- name: 创建 tag
if: ${{ steps.check-tag.outputs.exists == 'false' }}
if: steps.check-tag.outputs.exists == 'false'
run: git tag v${{ steps.package-version.outputs.version }} && git push --tags

- name: 发布 Release
if: ${{ steps.check-tag.outputs.exists == 'false' }}
if: steps.check-tag.outputs.exists == 'false'
uses: softprops/action-gh-release@v2
with:
name: v${{ steps.package-version.outputs.version }}
tag_name: v${{ steps.package-version.outputs.version }}

- name: 发布到 NPM
if: ${{ steps.check-tag.outputs.exists == 'false' }}
if: steps.check-tag.outputs.exists == 'false'
# 根据 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' }}
env:
Expand Down

0 comments on commit f3465e0

Please sign in to comment.