Skip to content

Commit bf380ba

Browse files
committed
.github: add name and target parameter to dispatch build
Signed-off-by: Richard Alpe <[email protected]>
1 parent ea2627d commit bf380ba

File tree

1 file changed

+26
-12
lines changed

1 file changed

+26
-12
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Build
33
on:
44
workflow_dispatch:
55
inputs:
6+
target:
7+
description: "Build target (e.g. aarch64)"
8+
default: "x86_64"
9+
type: string
610
flavor:
711
description: 'Optional build flavor (e.g. _minimal)'
812
default: ''
@@ -11,6 +15,10 @@ on:
1115
description: 'Massive parallel build of each image'
1216
default: true
1317
type: boolean
18+
name:
19+
description: "Name (for spin overrides)"
20+
default: "infix"
21+
type: string
1422
infix_repo:
1523
description: 'Repo to checkout (for spin overrides)'
1624
default: kernelkit/infix
@@ -39,12 +47,18 @@ on:
3947
default: false
4048

4149
env:
50+
NAME: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.name || inputs.name }}
51+
TARGET: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
4252
FLV: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.flavor || inputs.flavor }}
4353
INFIX_REPO: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.infix_repo || inputs.infix_repo }}
4454

4555
jobs:
4656
build:
47-
name: Build ${{ inputs.name }} ${{ inputs.target }}
57+
name: >
58+
Build
59+
${{ github.event_name == 'workflow_dispatch' && github.event.inputs.name || inputs.name }}
60+
${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
61+
4862
runs-on: [ self-hosted, latest ]
4963
strategy:
5064
fail-fast: false
@@ -81,8 +95,8 @@ jobs:
8195
| tee -a $GITHUB_OUTPUT $GITHUB_ENV
8296
fi
8397

84-
target=${{ inputs.target }}
85-
name=${{ inputs.name }}
98+
target=${{ env.TARGET }}
99+
name=${{ env.NAME }}
86100
echo "dir=${name}-${target}" >> $GITHUB_OUTPUT
87101
echo "tgz=${name}-${target}.tar.gz" >> $GITHUB_OUTPUT
88102
echo "flv=$FLV" >> $GITHUB_OUTPUT
@@ -100,16 +114,16 @@ jobs:
100114
uses: actions/cache@v4
101115
with:
102116
path: .ccache/
103-
key: ccache-${{ inputs.target }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
117+
key: ccache-${{ env.TARGET }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
104118
restore-keys: |
105-
ccache-${{ inputs.target }}-
119+
ccache-${{ env.TARGET }}-
106120
ccache-
107121

108-
- name: Configure ${{ inputs.target }}${{ steps.vars.outputs.flv }}
122+
- name: Configure ${{ env.TARGET }}${{ steps.vars.outputs.flv }}
109123
run: |
110-
make ${{ inputs.target }}${{ steps.vars.outputs.flv }}_defconfig
124+
make ${{ env.TARGET }}${{ steps.vars.outputs.flv }}_defconfig
111125

112-
- name: Unit Test ${{ inputs.target }}
126+
- name: Unit Test ${{ env.TARGET }}
113127
run: |
114128
make test-unit
115129

@@ -127,9 +141,9 @@ jobs:
127141
fi
128142
echo "MAKE=$MAKE" >> $GITHUB_OUTPUT
129143

130-
- name: Build ${{ inputs.target }}${{ steps.vars.outputs.flv }}
144+
- name: Build ${{ env.TARGET }}${{ steps.vars.outputs.flv }}
131145
run: |
132-
echo "Building ${{ inputs.target }}${{ steps.vars.outputs.flv }}_defconfig ..."
146+
echo "Building ${{ env.TARGET }}${{ steps.vars.outputs.flv }}_defconfig ..."
133147
eval "${{ steps.parallel.outputs.MAKE }}"
134148

135149
- name: Check SBOM from Build
@@ -151,7 +165,7 @@ jobs:
151165
printf "Size of output/images/: "
152166
ls -l output/images/
153167

154-
- name: Prepare ${{ inputs.target }} Artifact
168+
- name: Prepare ${{ env.TARGET }} Artifact
155169
run: |
156170
cd output/
157171
mv images ${{ steps.vars.outputs.dir }}
@@ -161,4 +175,4 @@ jobs:
161175
- uses: actions/upload-artifact@v4
162176
with:
163177
path: output/${{ steps.vars.outputs.tgz }}
164-
name: artifact-${{ inputs.target }}
178+
name: artifact-${{ env.TARGET }}

0 commit comments

Comments
 (0)