-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
43 lines (41 loc) · 1.12 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: '@actalog/node-pkg-cd'
description: Automates Node.js package publishing to npm registry
branding:
icon: package
color: green
inputs:
node-auth-token:
required: true
node-version:
required: false
default: 20
registry-url:
required: false
default: https://registry.npmjs.org
runs:
using: composite
steps:
- uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: npm
registry-url: ${{ inputs.registry-url }}
- id: scripts
run: |
scripts=$(cat package.json | jq -c '.scripts | keys')
echo "scripts=$scripts" >> $GITHUB_OUTPUT
shell: bash
- if: ${{ contains(steps.scripts.outputs.scripts, 'build') }}
run: |
npm ci || npm install
npm run build
shell: bash
- if: ${{ contains(steps.scripts.outputs.scripts, 'prepare') }}
run: |
jq 'del(.scripts.prepare)' package.json > package.tmp.json
mv package.tmp.json package.json
shell: bash
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ inputs.node-auth-token }}
shell: bash