-
Notifications
You must be signed in to change notification settings - Fork 3
/
action.yml
78 lines (75 loc) · 2.75 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
name: "Semantic release"
description: "This tool performs semantic release or returns value of next release version"
inputs:
dry_run:
description: "dry run - if only version should be returned without releasing new version"
default: "false"
required: false
extra_plugins:
description: "plugins beside semantic-release/changelog, semantic-release/git, semantic-release/exec are to be installed"
git_committer_name:
description: "committer name for semantic release changes"
required: false
default: "semantic-release-bot"
git_committer_email:
description: "committer email address for semantic release changes"
required: false
default: "semantic-release-bot"
gpg_private_key:
description: "gpg private key matching committer email"
required: false
passphrase:
description: "passphrase for gpg private key"
required: false
outputs:
new_release_version:
description: "Version of the new release"
value: ${{ steps.semantic.outputs.version }}
new_release_published:
description: "Whether a new release was published"
value: ${{ steps.semantic.outputs.new_release_published }}
runs:
using: "composite"
steps:
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: "20"
- name: Set up GPG
uses: crazy-max/ghaction-import-gpg@v6
if: ${{ (inputs.dry_run == 'false') && (inputs.gpg_private_key != '') && (inputs.passphrase != '') }}
with:
gpg_private_key: ${{ inputs.gpg_private_key }}
passphrase: ${{ inputs.passphrase }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Prepare Semantic Release
run: |
install_command="npm install --no-package-lock --legacy-peer-deps --save false -D @semantic-release/changelog @semantic-release/git @semantic-release/exec"
if [[ ! -z "${{ inputs.extra_plugins }}" ]]
then
while IFS= read -r line
do
if [ ! -z "$line" ];then
install_command="$install_command $(echo -e "$line" | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
fi
done <<< "${{ inputs.extra_plugins }}"
fi
$install_command
shell: bash
- id: semantic
run: |
if [[ ${{ inputs.dry_run }} == true ]]
then
echo "Running dry-run Semantic Release"
npx semantic-release@23 --dry-run
else
echo "Running Semantic Release"
npx semantic-release@23
fi
shell: bash
env:
GIT_AUTHOR_NAME: ${{ inputs.git_committer_name }}
GIT_AUTHOR_EMAIL: ${{ inputs.git_committer_email }}
GIT_COMMITTER_NAME: ${{ inputs.git_committer_name }}
GIT_COMMITTER_EMAIL: ${{ inputs.git_committer_email }}