Skip to content

Commit 5a0b3e5

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

File tree

1 file changed

+27
-12
lines changed

1 file changed

+27
-12
lines changed

.github/workflows/build.yml

Lines changed: 27 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,19 @@ 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+
# We can't use env.* here — environment variables aren't available in this scope.
58+
name: >
59+
Build
60+
${{ github.event_name == 'workflow_dispatch' && github.event.inputs.name || inputs.name }}
61+
${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
62+
4863
runs-on: [ self-hosted, latest ]
4964
strategy:
5065
fail-fast: false
@@ -81,8 +96,8 @@ jobs:
8196
| tee -a $GITHUB_OUTPUT $GITHUB_ENV
8297
fi
8398

84-
target=${{ inputs.target }}
85-
name=${{ inputs.name }}
99+
target=${{ env.TARGET }}
100+
name=${{ env.NAME }}
86101
echo "dir=${name}-${target}" >> $GITHUB_OUTPUT
87102
echo "tgz=${name}-${target}.tar.gz" >> $GITHUB_OUTPUT
88103
echo "flv=$FLV" >> $GITHUB_OUTPUT
@@ -100,16 +115,16 @@ jobs:
100115
uses: actions/cache@v4
101116
with:
102117
path: .ccache/
103-
key: ccache-${{ inputs.target }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
118+
key: ccache-${{ env.TARGET }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
104119
restore-keys: |
105-
ccache-${{ inputs.target }}-
120+
ccache-${{ env.TARGET }}-
106121
ccache-
107122

108-
- name: Configure ${{ inputs.target }}${{ steps.vars.outputs.flv }}
123+
- name: Configure ${{ env.TARGET }}${{ steps.vars.outputs.flv }}
109124
run: |
110-
make ${{ inputs.target }}${{ steps.vars.outputs.flv }}_defconfig
125+
make ${{ env.TARGET }}${{ steps.vars.outputs.flv }}_defconfig
111126

112-
- name: Unit Test ${{ inputs.target }}
127+
- name: Unit Test ${{ env.TARGET }}
113128
run: |
114129
make test-unit
115130

@@ -127,9 +142,9 @@ jobs:
127142
fi
128143
echo "MAKE=$MAKE" >> $GITHUB_OUTPUT
129144

130-
- name: Build ${{ inputs.target }}${{ steps.vars.outputs.flv }}
145+
- name: Build ${{ env.TARGET }}${{ steps.vars.outputs.flv }}
131146
run: |
132-
echo "Building ${{ inputs.target }}${{ steps.vars.outputs.flv }}_defconfig ..."
147+
echo "Building ${{ env.TARGET }}${{ steps.vars.outputs.flv }}_defconfig ..."
133148
eval "${{ steps.parallel.outputs.MAKE }}"
134149

135150
- name: Check SBOM from Build
@@ -151,7 +166,7 @@ jobs:
151166
printf "Size of output/images/: "
152167
ls -l output/images/
153168

154-
- name: Prepare ${{ inputs.target }} Artifact
169+
- name: Prepare ${{ env.TARGET }} Artifact
155170
run: |
156171
cd output/
157172
mv images ${{ steps.vars.outputs.dir }}
@@ -161,4 +176,4 @@ jobs:
161176
- uses: actions/upload-artifact@v4
162177
with:
163178
path: output/${{ steps.vars.outputs.tgz }}
164-
name: artifact-${{ inputs.target }}
179+
name: artifact-${{ env.TARGET }}

0 commit comments

Comments
 (0)