From d8785ba71c569be39e4819e2659b8473e59912db Mon Sep 17 00:00:00 2001 From: Zakary Timson Date: Fri, 15 Dec 2023 03:36:42 +0000 Subject: [PATCH] Update npm/publish/action.yaml --- npm/publish/action.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/npm/publish/action.yaml b/npm/publish/action.yaml index d231772..23cc72e 100644 --- a/npm/publish/action.yaml +++ b/npm/publish/action.yaml @@ -17,19 +17,25 @@ inputs: required: false description: Access Token default: ${{secrets.DEPLOY_TOKEN}} + branch: + type: string + required: false + description: Only publish for branch + default: develop runs: using: composite steps: - name: Setup registry run: | - if [ "${{github.ref_name}}" == "develop" ]; then + if [ "${{github.ref_name}}" == "${{inputs.branch}}" ]; then + TRIMMED=$(echo "${{inputs.registry}}" | sed s%http:%% | sed s%https:%%) echo "_authToken=${{inputs.token}}" > .npmrc - echo "registry=${{inputs.registry}}/api/packages/${{inputs.owner}}/npm/" >> .npmrc + echo "registry=$TRIMMED/api/packages/${{inputs.owner}}/npm/" >> .npmrc fi shell: sh - name: Publish uses: docker://node with: - args: /bin/sh -c "npm publish" + args: /bin/sh -c "[ \"${{github.ref_name}}\" == \"${{inputs.branch}}\" ] && npm publish"