Skip to content

Commit

Permalink
Merge pull request #103 from cloudcome/feat/v0.x
Browse files Browse the repository at this point in the history
fix: 优化 actions 32
  • Loading branch information
cloudcome authored Mar 17, 2023
2 parents 7277247 + 80b578c commit 0ab08e6
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions .github/actions/npm-publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,16 @@ runs:
name: 获取 package.json 信息
uses: jaywcjlove/github-action-package@main

# originName -> underscoreName
# my-pkg -> my-pkg
# @my-scope/my-pkg -> my-scope__my-pkg
- id: naming
name: 命名规则变更
shell: bash
# originName -> underscoreName
# my-pkg -> my-pkg
# @my-scope/my-pkg -> my-scope__my-pkg
env:
UNDERSCORE_NAME: ${${n1/@/}/\//__}
run: |
echo "N1=${{ steps.pkg.outputs.name }}" >> $GITHUB_ENV
echo "origin=$N1" >> "$GITHUB_OUTPUT"
echo "underscore=${${N1/@/}/\//__}" >> "$GITHUB_OUTPUT"
uses: frabert/replace-string-action@v2
with:
string: ${{ steps.pkg.outputs.name }}
pattern: '@(.*)\/(.*)'
replace-with: '$1__$2'

- name: 仓库类型是 npm
if: inputs.type == 'npm'
Expand All @@ -50,7 +48,7 @@ runs:
with:
data: |
{
"name": "@${{ github.repository_owner }}/${{ steps.naming.outputs.underscore }}"
"name": "@${{ github.repository_owner }}/${{ steps.naming.outputs.replaced }}"
}
# 发布
Expand Down

0 comments on commit 0ab08e6

Please sign in to comment.