-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
77 lines (68 loc) · 2.36 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: publish node package action
author: 云淡然 <hi@ydr.me> (https://ydr.me)
description: Publish a NodeJS package to NPM Repository or GitHub Packages
inputs:
target:
description: Packages target, optionally npm OR github
required: false
default: npm
token:
description: Target authorization token
required: true
tag:
description: The version tag to release, the default is latest
required: false
default: latest
dryRun:
description: Pretend to publish, but don't actually upload to the registry.
required: false
includePrivate:
description: publish private packages as well.
required: false
disableProvenance:
description: Disable provenance for npm publish.
required: false
# https://actions-cool.github.io/github-action-branding/
branding:
icon: 'package'
color: 'red'
runs:
using: node20
main: dist/index.cjs
# runs:
# using: composite
# steps:
# - name: Make a backup of the original .npmrc file
# shell: bash
# run: cp .npmrc .npmrc-orgin 2> /dev/null || true
# - name: Publish target is NPM Repository
# if: inputs.target == 'npm'
# shell: bash
# run: |
# echo "//registry.npmjs.org/:_authToken=${{ inputs.token }}" > .npmrc
# echo "registry=https://registry.npmjs.org/" >> .npmrc
# echo "provenance=true" >> .npmrc
# - name: Publish target is GitHub Packages
# if: inputs.target == 'github'
# shell: bash
# run: |
# echo "//npm.pkg.github.com/:_authToken=${{ github.token }}" > .npmrc
# echo "registry=https://npm.pkg.github.com/" >> .npmrc
# - name: Modify the package.json name to meet GitHub's naming requirements
# if: inputs.target == 'github'
# uses: actions/github-script@v7
# with:
# result-encoding: string
# script: |
# // https://github.com/actions/github-script/issues/322#issuecomment-1379056593
# const run = require('${{github.action_path}}/dist/index.cjs');
# await run(process.cwd(), context);
# - name: Publish
# shell: bash
# run: npm publish --tag ${{ inputs.tag }} ${{ inputs.workspaces && '-ws' || '' }} ${{ inputs.options }}
# - name: Restore the original .npmrc file
# if: always()
# shell: bash
# run: |
# rm -rf .npmrc
# mv .npmrc-origin .npmrc 2> /dev/null || true