Skip to content

Commit 80b578c

Browse files
committed
fix: 优化 actions 32
1 parent 01ea251 commit 80b578c

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

.github/actions/npm-publish/action.yml

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,16 @@ runs:
1616
name: 获取 package.json 信息
1717
uses: jaywcjlove/github-action-package@main
1818

19+
# originName -> underscoreName
20+
# my-pkg -> my-pkg
21+
# @my-scope/my-pkg -> my-scope__my-pkg
1922
- id: naming
2023
name: 命名规则变更
21-
shell: bash
22-
# originName -> underscoreName
23-
# my-pkg -> my-pkg
24-
# @my-scope/my-pkg -> my-scope__my-pkg
25-
env:
26-
UNDERSCORE_NAME: ${${n1/@/}/\//__}
27-
run: |
28-
echo "N1=${{ steps.pkg.outputs.name }}" >> $GITHUB_ENV
29-
echo "origin=$N1" >> "$GITHUB_OUTPUT"
30-
echo "underscore=${${N1/@/}/\//__}" >> "$GITHUB_OUTPUT"
24+
uses: frabert/replace-string-action@v2
25+
with:
26+
string: ${{ steps.pkg.outputs.name }}
27+
pattern: '@(.*)\/(.*)'
28+
replace-with: '$1__$2'
3129

3230
- name: 仓库类型是 npm
3331
if: inputs.type == 'npm'
@@ -50,7 +48,7 @@ runs:
5048
with:
5149
data: |
5250
{
53-
"name": "@${{ github.repository_owner }}/${{ steps.naming.outputs.underscore }}"
51+
"name": "@${{ github.repository_owner }}/${{ steps.naming.outputs.replaced }}"
5452
}
5553
5654
# 发布

0 commit comments

Comments
 (0)