-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yaml
More file actions
94 lines (81 loc) · 2.41 KB
/
action.yaml
File metadata and controls
94 lines (81 loc) · 2.41 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
name: Release it
description: Release it Composite Github Action
inputs:
release-branch:
description: Which branch you would like to release
default: main
dry-run:
description: "Dry run"
required: false
default: "false"
no-npm:
description: "Skip releasing it to npm"
required: false
default: "false"
no-git:
description: "Skip releasing it to Github"
required: false
default: "false"
manual-version:
description: "Sets explicit version for the release. For example: 1.0.0"
required: false
git-user:
description: "Github username"
required: true
git-email:
description: "Github email"
required: true
git-token:
description: "Github token to push release"
required: true
outputs:
version:
description: "Version of successful release"
value: ${{ steps.release-it.outputs.version }}
runs:
using: composite
steps:
- name: Setup Node
uses: actions/setup-node@v4.2.0
with:
node-version: lts/*
- name: Init Git user
shell: bash
run: |
git config --global user.email "${{ inputs.git-email }}"
git config --global user.name "${{ inputs.git-user }}"
- name: Install Dependencies
shell: bash
run: npm install -g @release-it/conventional-changelog release-it --ignore-scripts
- name: Release
id: release-it
env:
GITHUB_TOKEN: ${{ inputs.git-token }}
shell: bash
run: |
flags=("--ci")
# Handle dry-run flag
if [ "${{ inputs.dry-run }}" == "true" ]; then
flags+=("--dry-run")
fi
# Handle no-npm flag
if [ "${{ inputs.no-npm }}" == "true" ]; then
flags+=("--no-npm")
fi
# Handle no-git flag
if [ "${{ inputs.no-git }}" == "true" ]; then
flags+=("--no-git")
fi
# Handle pre-release based on branch (if not main)
if [ "${{ inputs.release-branch }}" != "main" ]; then
flags+=("--npm.tag=${{ inputs.release-branch }}")
flags+=("--preRelease=${{ inputs.release-branch }}")
fi
# Handle manual version input
if [ ! -z "${{ inputs.manual-version }}" ]; then
flags+=("${{ inputs.manual-version }}")
fi
# Print the full command to the CI log
echo "Running: release-it ${flags[*]}"
# Execute release-it with constructed flags
release-it "${flags[@]}"