11name : npm publish
2- description : |
3- 按仓库类型执行 npm publish,可以将包发布到 npm、github 等仓库
2+ description : 按仓库类型执行 npm publish,可以将包发布到 npm、github 等仓库,
43 如果是发布到 github 则会将 package.name 替换为 @${{ github.repository }}
54
65inputs :
@@ -15,22 +14,22 @@ runs:
1514 using : composite
1615 steps :
1716 - name : 仓库类型是 github
18- if : inputs.type == " github"
17+ if : inputs.type == ' github'
1918 run : |
2019 echo "//npm.pkg.github.com/:_authToken=${{ github.token }}" > .npmrc
2120 echo "registry=https://npm.pkg.github.com/" >> .npmrc
2221 echo "always-auth=true" >> .npmrc
2322 shell : bash
2423 - name : 修改 package.json name 为 @${{ github.repository }}
25- if : inputs.type == " github"
24+ if : inputs.type == ' github'
2625 uses : jaywcjlove/github-action-package@main
2726 with :
2827 data : |
2928 {
3029 "name": "@${{ github.repository }}"
3130 }
3231 - name : 仓库类型是 npm
33- if : inputs.type == " npm"
32+ if : inputs.type == ' npm'
3433 run : |
3534 echo "//registry.npmjs.org/:_authToken=${{ inputs.token }}" > .npmrc
3635 echo "registry=https://registry.npmjs.org/" >> .npmrc
3938 - run : npm publish
4039 shell : bash
4140 - id : pkg
42- if : inputs.type == " npm"
41+ if : inputs.type == ' npm'
4342 uses : jaywcjlove/github-action-package@main
4443 - name : 同步新版本到 npmmirror.com
45- if : inputs.type == " npm"
44+ if : inputs.type == ' npm'
4645 run : curl --silent -X PUT https://registry-direct.npmmirror.com/${{ steps.pkg.outputs.name }}/sync?sync_upstream=true
4746 shell : bash
0 commit comments