From 80b578c1929e2928095c433c73550b1dd7b69b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=23=E4=BA=91=E6=B7=A1=E7=84=B6?= Date: Sat, 18 Mar 2023 01:28:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=20actions=2032?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/actions/npm-publish/action.yml | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/.github/actions/npm-publish/action.yml b/.github/actions/npm-publish/action.yml index 56731b5..70ca906 100644 --- a/.github/actions/npm-publish/action.yml +++ b/.github/actions/npm-publish/action.yml @@ -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' @@ -50,7 +48,7 @@ runs: with: data: | { - "name": "@${{ github.repository_owner }}/${{ steps.naming.outputs.underscore }}" + "name": "@${{ github.repository_owner }}/${{ steps.naming.outputs.replaced }}" } # 发布