From 2eeac47ade02a3480b9d961530a911abb29df214 Mon Sep 17 00:00:00 2001 From: Guo-Rong <5484552+gkoh@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:33:15 +1030 Subject: [PATCH] Update workflow actions and M5Unified dependency. (#61) * Update M5Unified dependency * Use matrix strategy for releases --- .github/workflows/main.yml | 6 ++-- .github/workflows/release.yml | 65 +++++++++++++++++++---------------- platformio.ini | 2 +- 3 files changed, 39 insertions(+), 34 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 10ddc22..72be423 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Run clang-format style check uses: jidicula/clang-format-action@v4.9.0 @@ -39,10 +39,10 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' cache: 'pip' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e477ca2..7f0d8cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,24 +5,29 @@ on: tags: - 'v*' -env: - FURBLE_VERSION: ${{ github.ref_name }}+${{ github.run_attempt }} - M5STICKC_FIRMWARE: furble-m5stick-c-${{ github.ref_name }}+${{ github.run_attempt }}.bin - M5STICKC_PLUS_FIRMWARE: furble-m5stick-c-plus-${{ github.ref_name }}+${{ github.run_attempt }}.bin - M5STACK_CORE_FIRMWARE: furble-m5stack-core-${{ github.ref_name }}+${{ github.run_attempt }}.bin - M5STACK_CORE2_FIRMWARE: furble-m5stack-core2-${{ github.ref_name }}+${{ github.run_attempt }}.bin - jobs: build: + + strategy: + matrix: + platform: + - m5stick-c + - m5stick-c-plus + - m5stack-core + - m5stack-core2 + runs-on: ubuntu-latest permissions: contents: write + env: + FIRMWARE_NAME: furble-${{ matrix.platform }}-${{ github.ref_name }}+${{ github.run_attempt }}.bin + steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: '3.10' cache: 'pip' @@ -31,37 +36,37 @@ jobs: run: | pip install -r requirements.txt - - name: Build furble (M5StickC) - run: | - platformio run -e m5stick-c - cp -v .pio/build/m5stick-c/firmware.bin $M5STICKC_FIRMWARE + - name: Build furble (${{ matrix.platform }}) + run: platformio run -e ${{ matrix.platform }} - - name: Build furble (M5StickC Plus) - run: | - platformio run -e m5stick-c-plus - cp -v .pio/build/m5stick-c-plus/firmware.bin $M5STICKC_PLUS_FIRMWARE + - name: Rename binary (${{ matrix.platform}}) + run: mv .pio/build/${{ matrix.platform }}/firmware.bin $FIRMWARE_NAME - - name: Build furble (M5Stack Core) - run: | - platformio run -e m5stack-core - cp -v .pio/build/m5stack-core/firmware.bin $M5STACK_CORE_FIRMWARE + - name: Upload binary artifact (${{ matrix.platform }}) + uses: actions/upload-artifact@v4 + with: + name: ${{ env.FIRMWARE_NAME }} + path: ${{ env.FIRMWARE_NAME }} + if-no-files-found: error - - name: Build furble (M5Stack Core2) - run: | - platformio run -e m5stack-core2 - cp -v .pio/build/m5stack-core2/firmware.bin $M5STACK_CORE2_FIRMWARE + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download binary artifacts + uses: actions/download-artifact@v4 + with: + merge-multiple: true - name: Generate release hashes run: | - sha256sum $M5STICKC_FIRMWARE $M5STICKC_PLUS_FIRMWARE $M%M5STACK_CORE_FIRMWARE $M5STACK_CORE2_FIRMWARE > sha256sum.txt + ls -lR + sha256sum furble-*.bin > sha256sum.txt - name: Release uses: softprops/action-gh-release@v1 with: generate_release_notes: true files: | - ${{ env.M5STICKC_FIRMWARE }} - ${{ env.M5STICKC_PLUS_FIRMWARE }} - ${{ env.M5STACK_CORE_FIRMWARE }} - ${{ env.M5STACK_CORE2_FIRMWARE }} + furble-*.bin sha256sum.txt diff --git a/platformio.ini b/platformio.ini index 211dcf5..3c36c39 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1,7 +1,7 @@ [furble] build_flags = -D FURBLE_VERSION=\"${sysenv.FURBLE_VERSION}\" lib_deps = - M5Unified@0.1.9 + M5Unified@0.1.12 Battery Sense NimBLE-Arduino@1.4.1 mikalhart/TinyGPSPlus@1.0.3