diff options
author | Albert Y <[email protected]> | 2023-05-17 12:42:57 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2023-05-17 00:42:57 -0400 |
commit | b1ca9199de02dcb45d055a71807ff3894290fda7 (patch) | |
tree | a0600c6c3e288a41a200e55f46e9a18bbd2aa488 /.github | |
parent | a1e0607a22deb72ce4ac64e442f0baa721e32b0b (diff) | |
download | zmk-b1ca9199de02dcb45d055a71807ff3894290fda7.tar.gz zmk-b1ca9199de02dcb45d055a71807ff3894290fda7.zip |
fix(ci): Refactor prepare variable step
* Refactor workflow variables
* Use quotes to avoid word splitting
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/build-user-config.yml | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/.github/workflows/build-user-config.yml b/.github/workflows/build-user-config.yml index b1e0602d54..5891ddc1e2 100644 --- a/.github/workflows/build-user-config.yml +++ b/.github/workflows/build-user-config.yml @@ -39,8 +39,8 @@ jobs: - name: Fetch Build Matrix run: | - echo "build_matrix=$(yaml2json ${{ inputs.build_matrix_path }} | jq -c .)" >> $GITHUB_ENV - yaml2json ${{ inputs.build_matrix_path }} | jq + echo "build_matrix=$(yaml2json '${{ inputs.build_matrix_path }}' | jq -c .)" >> $GITHUB_ENV + yaml2json "${{ inputs.build_matrix_path }}" | jq build: runs-on: ubuntu-latest @@ -54,18 +54,13 @@ jobs: steps: - name: Prepare variables shell: sh -x {0} + env: + shield: ${{ matrix.shield }} run: | - if [ -n "${{ matrix.shield }}" ] - then - echo "extra_cmake_args=-DSHIELD=\"${{ matrix.shield }}\"" >> $GITHUB_ENV - echo "artifact_name=${{ matrix.shield }}-${{ matrix.board }}-zmk" >> $GITHUB_ENV - echo "display_name=${{ matrix.shield }} - ${{ matrix.board }}" >> $GITHUB_ENV - else - echo "extra_cmake_args=" >> $GITHUB_ENV - echo "artifact_name=${{ matrix.board }}-zmk" >> $GITHUB_ENV - echo "display_name=${{ matrix.board }}" >> $GITHUB_ENV - fi echo "zephyr_version=${ZEPHYR_VERSION}" >> $GITHUB_ENV + echo "extra_cmake_args=${shield:+-DSHIELD=\"$shield\"}" >> $GITHUB_ENV + echo "display_name=${shield:+$shield - }${{ matrix.board }}" >> $GITHUB_ENV + echo "artifact_name=${shield:+$shield-}${{ matrix.board }}-zmk" >> $GITHUB_ENV - name: Checkout uses: actions/checkout@v3 @@ -89,7 +84,7 @@ jobs: ${{ runner.os }}- - name: West Init - run: west init -l ${{ inputs.config_path }} + run: west init -l "${{ inputs.config_path }}" - name: West Update run: west update @@ -99,7 +94,7 @@ jobs: - name: West Build (${{ env.display_name }}) shell: sh -x {0} - run: west build -s zmk/app -b ${{ matrix.board }} -- -DZMK_CONFIG=${GITHUB_WORKSPACE}/${{ inputs.config_path }} ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }} + run: west build -s zmk/app -b "${{ matrix.board }}" -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/${{ inputs.config_path }}" ${{ env.extra_cmake_args }} ${{ matrix.cmake-args }} - name: ${{ env.display_name }} Kconfig file run: grep -v -e "^#" -e "^$" build/zephyr/.config | sort @@ -113,7 +108,7 @@ jobs: cp build/zephyr/zmk.uf2 "build/artifacts/${{ env.artifact_name }}.uf2" elif [ -f build/zephyr/zmk.${{ inputs.fallback_binary }} ] then - cp build/zephyr/zmk.${{ inputs.fallback_binary }} "build/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}" + cp "build/zephyr/zmk.${{ inputs.fallback_binary }}" "build/artifacts/${{ env.artifact_name }}.${{ inputs.fallback_binary }}" fi - name: Archive (${{ env.display_name }}) |