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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
name: Release
on:
workflow_dispatch:
inputs:
release:
type: choice
description: Release the asset
default: 'none'
options:
- none
- prerelease
- release
bump:
type: choice
description: Semver to bump
default: 'none'
options:
- none
- patch
- minor
- major
permissions:
contents: write
jobs:
create_tag:
name: Tag a new version of the package
runs-on: ubuntu-26.04
outputs:
tag_name: ${{ steps.ready_tag.outputs.tag_name }}
steps:
- name: Checkout 🧰
uses: actions/checkout@v7
- name: Install semver-tool asdf
uses: asdf-vm/actions/install@v4
with:
tool_versions: |
semver 3.4.0
- name: Get latest release
uses: rez0n/actions-github-release@v2.1
id: latest_release
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: ${{ github.repository }}
type: "nodraft"
- name: Prepare tag ⚙️
id: ready_tag
run: |
export VERSION=${{ steps.latest_release.outputs.release }}
echo "VERS: $VERSION"
if [[ ${{github.event.inputs.release}} == "release" ]]; then
OUT="notsemver"
if [[ "$VERSION" =~ "-pre" ]]; then
printf "is prerelease, bumping to release\n"
OUT=$(semver bump release "$VERSION")
printf "OUT: ${OUT}\n"\
printf "bumping by selected type.\n"
if [[ "${{github.event.inputs.bump}}" != "none" ]]; then
OUT=$(semver bump ${{github.event.inputs.bump}} "$OUT")
printf "OUT: ${OUT}\n"
else
printf "no type selected, not bumping for release.\n"
fi
elif [[ ! "$VERSION" =~ "-pre" ]]; then
printf "previous tag is a release, bumping by selected type.\n"
if [[ "${{github.event.inputs.bump}}" != "none" ]]; then
OUT=$(semver bump ${{github.event.inputs.bump}} "$VERSION")
printf "OUT: ${OUT}\n"
else
printf "previous tag is a release, but no bump selected. Defaulting to a patch bump.\n"
OUT=$(semver bump patch "$VERSION")
printf "OUT: ${OUT}\n"
fi
fi
else
OUT=""
if [[ ! "$VERSION" =~ "-pre" ]]; then
printf "pre-release from release, bumping by selected type and prerel\n"
if [[ ! ${{ github.event.inputs.bump }} == "none" ]]; then
OUT=$(semver bump ${{github.event.inputs.bump}} "$VERSION")
printf "OUT: ${OUT}\n"
else
printf "type not selected, defaulting to patch\n"
OUT=$(semver bump patch "$VERSION")
printf "OUT: ${OUT}\n"
fi
OUT="$OUT-pre"
OUT=$(semver bump prerel "$OUT")
printf "OUT: ${OUT}\n"
elif [[ "$VERSION" =~ "-pre" ]]; then
printf "pre-release to pre-release, bumping by selected type and or prerel version\n"
if [[ ! ${{ github.event.inputs.bump }} == "none" ]]; then
OUT=$(semver bump ${{github.event.inputs.bump}} "$VERSION")
printf "OUT: ${OUT}\n"
OUT="$OUT-pre"
printf "OUT: ${OUT}\n"
printf "bumping prerel\n"
OUT=$(semver bump prerel "$OUT")
printf "OUT: ${OUT}\n"
else
printf "type not selected, defaulting to new pre-release only\n"
printf "bumping prerel\n"
OUT=$(semver bump prerel "$VERSION")
printf "OUT: ${OUT}\n"
fi
fi
fi
echo "vOUT: v${OUT}"
echo tag_name=v$OUT >> $GITHUB_OUTPUT
- name: Push tag 📤
uses: rickstaa/action-create-tag@v1.7.2
if: ${{ steps.ready_tag.outputs.tag_name && !env.ACT }}
with:
tag: ${{ steps.ready_tag.outputs.tag_name }}
message: Pre-release ${{ steps.ready_tag.outputs.tag_name }}
build_linux_x86_64:
name: Build tagged artifact (Linux, x86_64)
uses: ./.github/workflows/build-linux-x86_64.yml
needs: [create_tag]
build_linux_arm64:
name: Build tagged artifact (Linux, arm64)
uses: ./.github/workflows/build-linux-arm64.yml
needs: [create_tag]
build_win_x86_64:
name: Build tagged artifact (Windows, arm64)
uses: ./.github/workflows/build-win-arm64.yml
needs: [create_tag]
build_win_arm64:
name: Build tagged artifact (Windows, x86_64)
uses: ./.github/workflows/build-win-x86_64.yml
needs: [create_tag]
build_macos:
name: Build tagged artifact (macOS)
uses: ./.github/workflows/build-mac.yml
needs: [create_tag]
release:
name: Release tagged artifacts
runs-on: ubuntu-26.04
needs: [create_tag, build_linux_x86_64, build_linux_arm64, build_win_x86_64, build_win_arm64, build_macos]
steps:
- name: Fetch package artifacts ⬇️
uses: actions/download-artifact@v8
with:
path: ./temp_artifacts
- name: Name release assets 🛠️
run: |
ARTIFACTS=("default" "arm64" "win" "win-noconsole" "win-arm64" "win-arm64-noconsole" "mac")
for artifact in "${ARTIFACTS[@]}"; do
echo "naming $artifact"
if [ "$artifact" = "default" ]; then
suffix=""
else
suffix="-$artifact"
fi
# stupid windows
if [[ "$artifact" == win* ]]; then
ext=".exe"
else
ext=""
fi
source="./temp_artifacts/PluginLoader$suffix"
dest="./PluginLoader$suffix$ext"
mv "$source"/PluginLoader$ext "$dest"
done
- name: Pre-release 📦
if: github.event.inputs.release == 'prerelease'
uses: softprops/action-gh-release@v3
with:
name: Prerelease ${{ needs.create_tag.outputs.tag_name }}
tag_name: ${{ needs.create_tag.outputs.tag_name }}
files: |
./PluginLoade*
prerelease: true
generate_release_notes: true
- name: Release 📦
if: github.event.inputs.release == 'release'
uses: softprops/action-gh-release@v3
with:
name: Release ${{ needs.create_tag.outputs.tag_name }}
tag_name: ${{ needs.create_tag.outputs.tag_name }}
files: |
./PluginLoade*
prerelease: false
generate_release_notes: true
|