From a347d35e5cbc344bb38138b44367f5caa38e3bfc Mon Sep 17 00:00:00 2001 From: Cappy Ishihara Date: Tue, 9 Jul 2024 12:38:49 +0700 Subject: [PATCH] Fix manual build arch parsing (#1454) * ci: custom runner option for custom build workflow call * fix: outputs * fix: manual parsing using jq * add arch to outputs --------- Signed-off-by: Cappy Ishihara --- .github/workflows/build.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d99db32d94..853784b9f7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,12 +9,20 @@ on: description: "Custom Builder" required: false default: "" + architecture: + description: "Architecture" + required: false + default: all + type: string + + jobs: parse: outputs: pkgs: ${{ steps.parsing.outputs.pkgs }} builder: ${{ inputs.custom_builder }} + arch: ${{ steps.parsing.outputs.arch }} runs-on: "ubuntu-latest" steps: - name: Parse Input @@ -22,6 +30,16 @@ jobs: run: | echo "${{ inputs.packages }}" | sed 's/ /\n/g' | sed 's/$/\//g' | jq -R . | jq -s . | jq -c . | sed 's/^/pkgs=/' >> $GITHUB_OUTPUT echo "builder=${{ inputs.custom_builder }}" >> $GITHUB_OUTPUT + arch="${{ inputs.architecture }}" + # Convert to json array using jq + # if arch is not all, convert to array + if [ "$arch" != "all" ]; then + # jq, array with single element as string + arch=$(echo $arch | sed 's/,/\n/g') + echo "arch=$(echo $arch | jq -Rs 'split("\n")' | jq 'map(select(length > 0))' | jq -c .)" >> $GITHUB_OUTPUT + else + echo "arch=$(echo '["aarch64", "x86_64"]' | jq -c .)" >> $GITHUB_OUTPUT + fi build: needs: parse @@ -29,7 +47,7 @@ jobs: matrix: pkg: ${{ fromJson(needs.parse.outputs.pkgs) }} version: ["40"] - arch: ${{ needs.parse.outputs.builder == "x86-64-lg" && ["x86_64"] || ["x86_64", "aarch64"] }} + arch: ${{ fromJson(needs.parse.outputs.arch) }} fail-fast: false runs-on: ${{ matrix.arch == 'aarch64' && 'ARM64' || needs.parse.outputs.builder && needs.parse.outputs.builder || 'ubuntu-latest' }} container: