-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
80 lines (73 loc) · 2.38 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
78
79
80
name: dripip
description: Use Dripip to automate package releases in your CI.
inputs:
isStable:
required: false
description: Is this a stable release? Values can be 'true' or 'false'. By default is 'false'.
extraFlags:
required: false
description: Extra CLI flags to append to the executed CLI command.
npmToken:
required: true
description: The NPM token that will be used to publish the package to the npm registry.
githubToken:
required: true
description: The GitHub token that will be used to create a GitHub release on the repository.
runs:
using: composite
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install Dependencies
shell: bash
run: |
corepack enable
if [ -f "pnpm-lock.yaml" ]; then
pnpm install
elif [ -f "package-lock.json" ]; then
npm install
elif [ -f "yarn.lock" ]; then
yarn_version=$(yarn --version)
yarn_version_major=${yarn_version:0:1}
if [ "${yarn_version_major}" = '1' ]; then
yarn install --immutable
else
yarn install --frozen-lockfile
fi
else
echo "Could not detect which package manager is being used."
exit 1
fi
# TODO Do not assume that dripip is locally installed.
- name: Publish Release
shell: bash
env:
NPM_TOKEN: ${{inputs.npmToken}}
GITHUB_TOKEN: ${{inputs.githubToken}}
run: |
if [ '${{inputs.isStable}}' = 'true' ]; then
sub_command='stable'
else
sub_command='preview-or-pr'
fi
if [ -f "pnpm-lock.yaml" ]; then
pnpm dripip ${sub_command} --json ${{inputs.extraFlags}}
elif [ -f "package-lock.json" ]; then
npx dripip ${sub_command} --json ${{inputs.extraFlags}}
elif [ -f "yarn.lock" ]; then
yarn_version=$(yarn --version)
yarn_version_major=${yarn_version:0:1}
if [ "${yarn_version_major}" = '1' ]; then
silent_flag='--silent'
else
silent_flag=''
fi
yarn ${silent_flag} dripip ${sub_command} --json ${{inputs.extraFlags}}
else
echo "Could not detect which package manager is being used."
exit 1
fi