diff --git a/.github/actions/npm-publish/action.yml b/.github/actions/npm-publish/action.yml index 0f57b14..34e4550 100644 --- a/.github/actions/npm-publish/action.yml +++ b/.github/actions/npm-publish/action.yml @@ -1,6 +1,5 @@ name: npm publish -description: | - 按仓库类型执行 npm publish,可以将包发布到 npm、github 等仓库 +description: 按仓库类型执行 npm publish,可以将包发布到 npm、github 等仓库, 如果是发布到 github 则会将 package.name 替换为 @${{ github.repository }} inputs: @@ -15,14 +14,14 @@ runs: using: composite steps: - name: 仓库类型是 github - if: inputs.type == "github" + if: inputs.type == 'github' run: | echo "//npm.pkg.github.com/:_authToken=${{ github.token }}" > .npmrc echo "registry=https://npm.pkg.github.com/" >> .npmrc echo "always-auth=true" >> .npmrc shell: bash - name: 修改 package.json name 为 @${{ github.repository }} - if: inputs.type == "github" + if: inputs.type == 'github' uses: jaywcjlove/github-action-package@main with: data: | @@ -30,7 +29,7 @@ runs: "name": "@${{ github.repository }}" } - name: 仓库类型是 npm - if: inputs.type == "npm" + if: inputs.type == 'npm' run: | echo "//registry.npmjs.org/:_authToken=${{ inputs.token }}" > .npmrc echo "registry=https://registry.npmjs.org/" >> .npmrc @@ -39,9 +38,9 @@ runs: - run: npm publish shell: bash - id: pkg - if: inputs.type == "npm" + if: inputs.type == 'npm' uses: jaywcjlove/github-action-package@main - name: 同步新版本到 npmmirror.com - if: inputs.type == "npm" + if: inputs.type == 'npm' run: curl --silent -X PUT https://registry-direct.npmmirror.com/${{ steps.pkg.outputs.name }}/sync?sync_upstream=true shell: bash