-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
61 lines (53 loc) · 1.72 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
name: "Release"
description: "Semantically release package"
inputs:
directory:
description: "where to run the release"
required: false
default: "."
add_config:
description: "wether to set default release config"
required: false
default: true
branches:
description: "custom branches configuration (see https://semantic-release.gitbook.io/semantic-release/usage/configuration#branches)"
required: false
default: false
pre_release:
description: "wether to publish pre-releases from PRs"
required: false
default: true
gh_token:
description: "A Github PAT"
required: false
default: ${{ github.token }}
npm_token:
description: "token with which to publish to npm"
required: false
default: ${{ github.token }}
runs:
using: "composite"
steps:
- shell: bash
env:
GITHUB_TOKEN: ${{ inputs.gh_token }}
NPM_TOKEN: ${{ inputs.npm_token }}
NODE_AUTH_TOKEN: ${{ inputs.npm_token }}
run: |
cd ${{ inputs.directory }}
if [ "${{inputs.add_config}}" = true ]; then
cp ${{ github.action_path }}/release.config.template.js ./release.config.cjs
fi
BRANCHES_FLAG=""
BRANCHES_VALUE=""
if [ "${{inputs.branches}}" != false ]; then
BRANCHES_FLAG="--branches"
BRANCHES_VALUE="${{inputs.branches}}"
fi
if [ "${{github.event_name}}" = "push" ]; then
npx semantic-release@19 $BRANCHES_FLAG $BRANCHES_VALUE
fi
if [ "${{github.event_name}}" = "pull_request" ] && [ "${{inputs.pre_release}}" = true ]; then
npm i decorate-gh-pr --no-save &&
npx semantish-prerelease@4 --release-pr $BRANCHES_FLAG $BRANCHES_VALUE
fi