Skip to content

Commit

Permalink
Feat: CI 添加将包发布至 npm 的流程
Browse files Browse the repository at this point in the history
  • Loading branch information
WendaoLee committed Sep 19, 2024
1 parent 1231b2b commit ace3449
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Build delopy
run: npm run build

- name: Check if version is already published
- name: Check if version is already published - github package
id: check_version
run: |
if npm view @hk-artificial-intelligence-association/weibo-api@${{ steps.get_version.outputs.version }} version; then
Expand All @@ -82,6 +82,23 @@ jobs:
echo "::set-output name=should_publish::true"
fi
- name: Publish to npm
- name: github package publish
if: steps.check_version.outputs.should_publish == 'true'
run: ./publish.sh -t ${{ secrets.GITHUB_TOKEN}}
run: ./publish.sh -t ${{ secrets.GITHUB_TOKEN}}

- name: Check if version is already published - npm
id: check_version_npm
run: |
if npm view @hk-artificial-intelligence-association/weibo-api@${{ steps.get_version.outputs.version }} version; then
echo "Version ${{ steps.get_version.outputs.version }} is already published."
echo "::set-output name=should_publish::false"
else
echo "Version ${{ steps.get_version.outputs.version }} is not published."
echo "::set-output name=should_publish::true"
fi
- name: npm package publish
if: steps.check_version_npm.outputs.should_publish == 'true'
run: |
echo ${{ secrets.NPM_TOKEN }} > .npmrc
npm publish

0 comments on commit ace3449

Please sign in to comment.