Skip to content

Commit 8abc49d

Browse files
authored
Improve GitHub Actions to make releases way more intuitive, thanks @rluzuriaga
* Change ubuntu-latest to ubuntu-22.04 * Change inputs and release job * Add pre-processing job and minor fixes
1 parent 86d3d27 commit 8abc49d

File tree

1 file changed

+73
-34
lines changed

1 file changed

+73
-34
lines changed

.github/workflows/create_release.yml

Lines changed: 73 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,42 @@ name: Create Release
33
on:
44
workflow_dispatch:
55
inputs:
6-
release_name:
7-
type: string
8-
description: "Release Name"
9-
required: true
10-
tag_name:
11-
type: string
12-
description: "Tag Name"
13-
required: true
14-
is_prerelease:
6+
is_official_release:
157
type: boolean
168
default: false
17-
description: "Pre-release?"
18-
required: true
19-
linux_kernel_version:
20-
type: string
21-
description: "Linux kernel version"
22-
required: true
23-
buildroot_version:
24-
type: string
25-
description: "Buildroot version"
26-
required: true
27-
extra_description:
9+
description: "Official Release?"
10+
required: false
11+
official_fog_version:
2812
type: string
29-
description: "Description"
13+
description: "Official Release FOG Version"
3014
required: false
3115

3216
defaults:
3317
run:
3418
shell: bash
3519

3620
jobs:
21+
input_checks:
22+
runs-on: ubuntu-22.04
23+
24+
steps:
25+
- name: Make sure that the input text field is filled in if the input checkbox is selected and vice versa
26+
run: |
27+
is_official="${{ inputs.is_official_release }}"
28+
fog_version="${{ inputs.official_fog_version }}"
29+
if [[ "$is_official" == "true" && "$fog_version" == "" ]]; then
30+
echo "Official FOG Version was not entered, but Official Release checkbox was selected!"
31+
exit 1
32+
fi
33+
if [[ "$is_official" == "false" && "$fog_version" != "" ]]; then
34+
echo "Official Release checkbox was not selected, but Official Release FOG Version was entered!"
35+
exit 1
36+
fi
37+
3738
build_kernel_arm64:
38-
runs-on: ubuntu-latest
39+
needs: input_checks
40+
41+
runs-on: ubuntu-22.04
3942

4043
steps:
4144
- name: Checkout code
@@ -61,7 +64,9 @@ jobs:
6164
retention-days: 1
6265

6366
build_kernel_x86:
64-
runs-on: ubuntu-latest
67+
needs: input_checks
68+
69+
runs-on: ubuntu-22.04
6570

6671
steps:
6772
- name: Checkout code
@@ -87,7 +92,9 @@ jobs:
8792
retention-days: 1
8893

8994
build_kernel_x64:
90-
runs-on: ubuntu-latest
95+
needs: input_checks
96+
97+
runs-on: ubuntu-22.04
9198

9299
steps:
93100
- name: Checkout code
@@ -113,7 +120,9 @@ jobs:
113120
retention-days: 1
114121

115122
build_initrd_arm64:
116-
runs-on: ubuntu-latest
123+
needs: input_checks
124+
125+
runs-on: ubuntu-22.04
117126

118127
steps:
119128
- name: Checkout code
@@ -146,7 +155,9 @@ jobs:
146155
retention-days: 30
147156

148157
build_initrd_x86:
149-
runs-on: ubuntu-latest
158+
needs: input_checks
159+
160+
runs-on: ubuntu-22.04
150161

151162
steps:
152163
- name: Checkout code
@@ -179,7 +190,9 @@ jobs:
179190
retention-days: 30
180191

181192
build_initrd_x64:
182-
runs-on: ubuntu-latest
193+
needs: input_checks
194+
195+
runs-on: ubuntu-22.04
183196

184197
steps:
185198
- name: Checkout code
@@ -222,12 +235,40 @@ jobs:
222235
build_initrd_x64,
223236
]
224237

225-
runs-on: ubuntu-latest
238+
runs-on: ubuntu-22.04
226239

227240
steps:
241+
- name: Checkout code
242+
uses: actions/checkout@v3
243+
228244
- name: Download distribution files
229245
uses: actions/download-artifact@v3
230246

247+
- name: Set release name variable
248+
run: |
249+
echo "RELEASE_NAME=Latest from $(date '+%Y-%m-%d')" >> $GITHUB_ENV
250+
251+
- name: Set tag name variable
252+
run: |
253+
echo "TAG_NAME=$(date '+%Y%m%d')" >> $GITHUB_ENV
254+
255+
- name: Get Linux Kernel version from build.sh
256+
run: |
257+
echo "LINUX_KERNEL_VER=$(cat build.sh | sed -n -e 's/^.*KERNEL_VERSION=//p' | cut -d\' -f 2)" >> $GITHUB_ENV
258+
259+
- name: Get Buildroot version from build.sh
260+
run: |
261+
echo "BUILDROOT_VER=$(cat build.sh | sed -n -e 's/^.*BUILDROOT_VERSION=//p' | cut -d\' -f 2)" >> $GITHUB_ENV
262+
263+
- name: Set release name and tag name variable if it is an Official FOG release
264+
run: |
265+
is_official="${{ inputs.is_official_release }}"
266+
fog_version="${{ inputs.official_fog_version }}"
267+
if [[ ${{ inputs.is_official_release }} == "true" ]]; then
268+
echo "RELEASE_NAME=FOG $fog_version kernels and inits" >> $GITHUB_ENV
269+
echo "TAG_NAME=$fog_version" >> $GITHUB_ENV
270+
fi
271+
231272
- name: Run sha256 checksum on all files
232273
run: |
233274
cd distribution-files
@@ -237,13 +278,11 @@ jobs:
237278
- name: Create release
238279
uses: softprops/action-gh-release@v1
239280
with:
240-
name: ${{ github.event.inputs.release_name }}
241-
prerelease: ${{ github.event.inputs.is_prerelease }}
281+
name: ${{ env.RELEASE_NAME }}
242282
body: |
243-
Linux kernel ${{ github.event.inputs.linux_kernel_version }}
244-
Buildroot ${{ github.event.inputs.buildroot_version }}
245-
${{ github.event.inputs.extra_description }}
246-
tag_name: ${{ github.event.inputs.tag_name }}
283+
Linux kernel ${{ env.LINUX_KERNEL_VER }}
284+
Buildroot ${{ env.BUILDROOT_VER }}
285+
tag_name: ${{ env.TAG_NAME }}
247286
files: |
248287
distribution-files/arm_Image
249288
distribution-files/arm_Image.sha256

0 commit comments

Comments
 (0)