-
-
Notifications
You must be signed in to change notification settings - Fork 1
294 lines (245 loc) · 13.1 KB
/
release.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
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
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
name: "📦 Release"
run-name: "📦 Release"
on:
workflow_dispatch:
inputs:
# ---------------------------------------------------------------------------------------
# Name of the plugin to use when creating the release zip filename
# e.g: csf-firewall-v1.0.0.zip
# ---------------------------------------------------------------------------------------
PLUGIN_NAME:
description: "📦 Name of Plugin"
required: true
default: 'csf-firewall'
type: string
# ---------------------------------------------------------------------------------------
# Version to release
# e.g: v1.0.0
# ---------------------------------------------------------------------------------------
PLUGIN_VERSION:
description: "📦 Version"
required: true
default: '1.x.x'
type: string
# ---------------------------------------------------------------------------------------
# ENABLE: the changelog generated in releases tab will only display single commits.
# DISABLE: the changelog shows pull requests completed based on their labels
# ---------------------------------------------------------------------------------------
CHANGELOG_MODE_COMMIT:
description: "📑 Use Commits Instead of PRs"
required: true
default: true
type: boolean
# ---------------------------------------------------------------------------------------
# ENABLE: Will show all types of commits, including uncategorized
# DISABLE: WIll only show actions that have been categorized using the format
# type(scope): description
# type: description
# ---------------------------------------------------------------------------------------
SHOW_UNCATEGORIZED:
description: "🗂️ Show Uncategorized Commits"
required: true
default: false
type: boolean
# ---------------------------------------------------------------------------------------
# ENABLE: released version will be marked as pre-release
# DISABLE: release version will be marked as stable / normal release
# ---------------------------------------------------------------------------------------
PRERELEASE:
description: "🧪 Build RC (Pre-release)"
required: true
default: false
type: boolean
# ---------------------------------------------------------------------------------------
# Release Candidate version number
# this will be added to the end of your released app in the releases page.
# e.g: csf-firewall-v1.0.0-rc.1
# ---------------------------------------------------------------------------------------
VERSION_RC:
description: "🧪 RC (Pre-release) Ver (csf-firewall-rc.v1)"
required: false
type: string
default: "1"
# ---------------------------------------------------------------------------------------
# environment variables
# ---------------------------------------------------------------------------------------
env:
PLUGIN_NAME: csf-firewall
ASSIGN_USER: Aetherinox
BOT_NAME_1: AdminServ
BOT_NAME_2: AdminServX
BOT_NAME_3: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
# ---------------------------------------------------------------------------------------
# jobs
# ---------------------------------------------------------------------------------------
jobs:
# ---------------------------------------------------------------------------------------
# JOB > INITIALIZE
# ---------------------------------------------------------------------------------------
job-upload:
name: >-
📦 Package › Upload
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
outputs:
version_csf: ${{ steps.task_build_download_csf.outputs.VERSION_CSF }}
version_build: ${{ steps.task_build_download_csf.outputs.VERSION_BUILD }}
version_tag_previous: ${{ steps.task_build_getver.outputs.VERSION_TAG_PREV }}
steps:
# ---------------------------------------------------------------------------------------
# Job > Start
# ---------------------------------------------------------------------------------------
- name: "✅ Start"
id: task_build_start
run: |
echo "Starting build"
# ---------------------------------------------------------------------------------------
# Job > Checkout
# ---------------------------------------------------------------------------------------
- name: "☑️ Checkout"
id: task_build_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# ---------------------------------------------------------------------------------------
# Job > Get Previous Tag
#
# this is for no particular reason except to just report the last version released
# ---------------------------------------------------------------------------------------
- name: "🏷️ Get Previous tag"
id: task_tag_previous
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
fallback: 1.0.0
# ---------------------------------------------------------------------------------------
# Job > Print Current Version
#
# this is for no particular reason except to just report the last version released
# ---------------------------------------------------------------------------------------
- name: "🔨 Debug: Previous Github Tag"
id: task_build_getver
run: |
echo -e ${{ steps.task_tag_previous.outputs.tag }}
echo "VERSION_TAG_PREV=${{ steps.task_tag_previous.outputs.tag }}" >> $GITHUB_OUTPUT
# ---------------------------------------------------------------------------------------
# Job > Download latest version of ConfigServer Firewall
#
# download csf .tgz from official website
# read /csf/version.txt inside the .tgz and grab version, assign to env var
# rename original .tgz to new name which includes version number:
# - csf-firewall.tgz => csf-firewall-v14.20.tgz
# ---------------------------------------------------------------------------------------
- name: "⬇️ Download: ConfigServer Firewall"
id: task_build_download_csf
run: |
mkdir release
wget https://download.configserver.com/csf.tgz -O release/${{ inputs.PLUGIN_NAME }}.tgz
# #
# generate build number
# 2408.07 (YYMM.DD)
# #
ver_build=$(date -u '+%y%m-%d')
echo "VERSION_BUILD=$ver_build" >> $GITHUB_OUTPUT
# #
# get csf version from version.txt in .tgz
# #
ver_csf=$(tar -axf release/${{ inputs.PLUGIN_NAME }}.tgz csf/version.txt -O)
echo "VERSION_CSF=$ver_csf" >> $GITHUB_OUTPUT
echo -e "Found ConfigServer Firewall v${ver_csf}"
# #
# rename .tgz
# #
mv release/${{ inputs.PLUGIN_NAME }}.tgz release/${{ inputs.PLUGIN_NAME }}-v${ver_csf}.tgz
echo -e "Creating release/${{ inputs.PLUGIN_NAME }}-v${ver_csf}.tgz"
# ---------------------------------------------------------------------------------------
# Upload artifacts > release/csf-firewall-v14.20.tgz
# ---------------------------------------------------------------------------------------
- name: >-
📋 Upload Artifacts › ${{ inputs.PLUGIN_NAME }}.tgz
id: task_build_artifact_csf
uses: actions/upload-artifact@v4
if: always()
with:
name: ${{ inputs.PLUGIN_NAME }}-v${{ steps.task_build_download_csf.outputs.VERSION_CSF }}.tgz
path: release/${{ inputs.PLUGIN_NAME }}-v${{ steps.task_build_download_csf.outputs.VERSION_CSF }}.tgz
retention-days: 30
# ---------------------------------------------------------------------------------------
# Job > Release
# ---------------------------------------------------------------------------------------
job-release:
name: >-
📦 Package › Release
runs-on: ubuntu-latest
needs: [ job-upload ]
permissions:
contents: write
packages: write
env:
VERSION_CSF: ${{ needs.job-upload.outputs.version_csf }}
VERSION_BUILD: ${{ needs.job-upload.outputs.version_build }}
VERSION_TAG_PREV: ${{ needs.job-upload.outputs.version_tag_previous }}
steps:
# ---------------------------------------------------------------------------------------
# Dist Releases > Checkout
# ---------------------------------------------------------------------------------------
- name: "☑️ Checkout"
uses: actions/checkout@v4
id: task_release_checkout
with:
fetch-depth: 0
# ---------------------------------------------------------------------------------------
# Debug : View passed values
# ---------------------------------------------------------------------------------------
- name: "⚙️ Debug › Passed Values"
id: task_release_debug_print_vals_1
run: |
echo "TAG VERSION (Previous) ........... ${{ env.VERSION_TAG_PREV }}"
echo "TAG VERSION (Next) ............... ${{ inputs.PLUGIN_VERSION }}"
echo "CSF VERSION ...................... ${{ env.VERSION_CSF }}"
echo "RELEASE BUILD .................... ${{ env.VERSION_BUILD }}"
# ---------------------------------------------------------------------------------------
# Build Project & Create Zip
# ---------------------------------------------------------------------------------------
- name: "🔨 Build › Stable ( ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}.zip )"
id: task_release_build_st
if: ${{ startsWith( inputs.PRERELEASE, false ) }}
run: |
echo Building STABLE Package .zip ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}.zip
mv patch/* .
zip -r ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}.zip README.md LICENSE *.sh
ls
env:
NODE_AUTH_TOKEN: ${{ secrets.ADMINSERV_TOKEN_CL }}
- name: "🔨 Build › Release Candidate ( ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}-rc.${{ inputs.VERSION_RC }}.zip )"
id: task_release_build_rc
if: ${{ startsWith( inputs.PRERELEASE, true ) }}
run: |
echo Building PRE-RELEASE Package .zip ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}-rc.${{ inputs.VERSION_RC }}.zip
zip -r ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}-rc.${{ inputs.VERSION_RC }}.zip README.md LICENSE *.sh
ls
env:
NODE_AUTH_TOKEN: ${{ secrets.ADMINSERV_TOKEN_CL }}
# ---------------------------------------------------------------------------------------
# Upload artifacts > csf-firewall-v14.20*.zip
# ---------------------------------------------------------------------------------------
- name: >-
📋 Upload Artifacts › ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}.zip
id: task_release_artifact_st
if: ${{ startsWith( inputs.PRERELEASE, false ) }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}
path: ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}.zip
retention-days: 30
- name: >-
📋 Upload Artifacts › ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}-rc.${{ inputs.VERSION_RC }}.zip
id: task_release_artifact_rc
if: ${{ startsWith( inputs.PRERELEASE, true ) }}
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}-rc.${{ inputs.VERSION_RC }}
path: ${{ inputs.PLUGIN_NAME }}-${{ env.VERSION_CSF }}-rc.${{ inputs.VERSION_RC }}.zip
retention-days: 30