Skip to content

Commit c804c31

Browse files
committed
.github: add target parameter to dispatch build
Signed-off-by: Richard Alpe <richard@bit42.se>
1 parent ea2627d commit c804c31

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

.github/workflows/build.yml

Lines changed: 16 additions & 11 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: ''
@@ -39,12 +43,13 @@ on:
3943
default: false
4044

4145
env:
46+
TARGET: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.target || inputs.target }}
4247
FLV: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.flavor || inputs.flavor }}
4348
INFIX_REPO: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.infix_repo || inputs.infix_repo }}
4449

4550
jobs:
4651
build:
47-
name: Build ${{ inputs.name }} ${{ inputs.target }}
52+
name: Build ${{ inputs.name }} ${{ env.TARGET }}
4853
runs-on: [ self-hosted, latest ]
4954
strategy:
5055
fail-fast: false
@@ -81,7 +86,7 @@ jobs:
8186
| tee -a $GITHUB_OUTPUT $GITHUB_ENV
8287
fi
8388
84-
target=${{ inputs.target }}
89+
target=${{ env.TARGET }}
8590
name=${{ inputs.name }}
8691
echo "dir=${name}-${target}" >> $GITHUB_OUTPUT
8792
echo "tgz=${name}-${target}.tar.gz" >> $GITHUB_OUTPUT
@@ -100,16 +105,16 @@ jobs:
100105
uses: actions/cache@v4
101106
with:
102107
path: .ccache/
103-
key: ccache-${{ inputs.target }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
108+
key: ccache-${{ env.TARGET }}-${{ hashFiles('.git/modules/buildroot/HEAD', 'package/*/*.hash') }}
104109
restore-keys: |
105-
ccache-${{ inputs.target }}-
110+
ccache-${{ env.TARGET }}-
106111
ccache-
107112
108-
- name: Configure ${{ inputs.target }}${{ steps.vars.outputs.flv }}
113+
- name: Configure ${{ env.TARGET }}${{ steps.vars.outputs.flv }}
109114
run: |
110-
make ${{ inputs.target }}${{ steps.vars.outputs.flv }}_defconfig
115+
make ${{ env.TARGET }}${{ steps.vars.outputs.flv }}_defconfig
111116
112-
- name: Unit Test ${{ inputs.target }}
117+
- name: Unit Test ${{ env.TARGET }}
113118
run: |
114119
make test-unit
115120
@@ -127,9 +132,9 @@ jobs:
127132
fi
128133
echo "MAKE=$MAKE" >> $GITHUB_OUTPUT
129134
130-
- name: Build ${{ inputs.target }}${{ steps.vars.outputs.flv }}
135+
- name: Build ${{ env.TARGET }}${{ steps.vars.outputs.flv }}
131136
run: |
132-
echo "Building ${{ inputs.target }}${{ steps.vars.outputs.flv }}_defconfig ..."
137+
echo "Building ${{ env.TARGET }}${{ steps.vars.outputs.flv }}_defconfig ..."
133138
eval "${{ steps.parallel.outputs.MAKE }}"
134139
135140
- name: Check SBOM from Build
@@ -151,7 +156,7 @@ jobs:
151156
printf "Size of output/images/: "
152157
ls -l output/images/
153158
154-
- name: Prepare ${{ inputs.target }} Artifact
159+
- name: Prepare ${{ env.TARGET }} Artifact
155160
run: |
156161
cd output/
157162
mv images ${{ steps.vars.outputs.dir }}
@@ -161,4 +166,4 @@ jobs:
161166
- uses: actions/upload-artifact@v4
162167
with:
163168
path: output/${{ steps.vars.outputs.tgz }}
164-
name: artifact-${{ inputs.target }}
169+
name: artifact-${{ env.TARGET }}

0 commit comments

Comments
 (0)