actions/npm/publish/action.yaml

44 lines
1.2 KiB
YAML
Raw Normal View History

2023-12-13 22:51:26 -05:00
name: NPM Publish
description: Push to registry
inputs:
owner:
type: string
required: false
description: Owner to publish to
default: ${{github.repository_owner}}
2023-12-14 23:09:00 -05:00
registry:
type: string
required: false
description: NPM registry FQDM
default: ${{github.server_url}}/api/packages/${{inputs.owner}}/npm/
2023-12-13 22:51:26 -05:00
token:
type: string
required: false
description: Access Token
default: ${{secrets.DEPLOY_TOKEN}}
2023-12-14 22:36:42 -05:00
branch:
type: string
required: false
description: Only publish for branch
default: develop
2023-12-13 22:51:26 -05:00
runs:
using: composite
steps:
- name: Setup registry
run: |
2023-12-14 22:36:42 -05:00
if [ "${{github.ref_name}}" == "${{inputs.branch}}" ]; then
TRIMMED=$(echo "${{inputs.registry}}" | sed s%http:%% | sed s%https:%%)
2023-12-14 22:23:41 -05:00
echo "_authToken=${{inputs.token}}" > .npmrc
2023-12-14 23:09:00 -05:00
echo "registry=${{inputs.registry}}" >> .npmrc
2023-12-14 23:14:00 -05:00
npm publish
2023-12-14 22:23:41 -05:00
fi
2023-12-13 22:51:26 -05:00
shell: sh
- name: Publish
2023-12-14 22:43:47 -05:00
if: ${{github.ref_name}} == ${{inputs.branch}}
2023-12-13 22:51:26 -05:00
uses: docker://node
with:
2023-12-14 23:14:00 -05:00
args: /bin/bash -c 'echo "_authToken=${{inputs.token}}" > .npmrc && echo "registry=${{inputs.registry}}" >> .npmrc && npm publish'