From a93617de60a9c02dab42e2b67f58b593030f1763 Mon Sep 17 00:00:00 2001 From: gab-k Date: Thu, 2 Jan 2025 10:37:18 +0100 Subject: [PATCH] Update workflow files --- .github/workflows/build_sw.yml | 60 +---------------------------- .github/workflows/prerelease.yml | 65 ++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 65 ++++++++++++++++++++++++++++++++ 3 files changed, 131 insertions(+), 59 deletions(-) create mode 100644 .github/workflows/prerelease.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build_sw.yml b/.github/workflows/build_sw.yml index 867fdfa..ecfc7c8 100644 --- a/.github/workflows/build_sw.yml +++ b/.github/workflows/build_sw.yml @@ -7,8 +7,6 @@ on: branches: - dev # Trigger on push to 'dev' branch - main # Trigger on push to 'main' branch - tags: - - '*' # Trigger on any tag push paths: - '.github/workflows/build_sw.yml' # Trigger if this workflow file changes - 'Software/**' # Trigger if any file in the 'Software' directory changes @@ -41,60 +39,4 @@ jobs: - name: Build # Build your program with the given configuration run: cmake --build ${{github.workspace}}/Software/build --config ${{env.BUILD_TYPE}} - - - name: Upload build files as artifact - uses: actions/upload-artifact@v4 - with: - name: build_files - path: ${{github.workspace}}/Software/build - - release-dev: - if: github.ref == 'refs/heads/dev' # Only deploy on 'dev' branch - runs-on: ubuntu-latest - needs: build - steps: - - name: Download build files artifact - uses: actions/download-artifact@v4 - with: - name: build_files - - - name: Display structure of downloaded files - run: ls - - - name: Release - uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') - with: - prerelease: true - files: | - RP2040-Decoder.bin - RP2040-Decoder.dis - RP2040-Decoder.elf - RP2040-Decoder.elf.map - RP2040-Decoder.hex - RP2040-Decoder.uf2 - - release-main: - if: github.ref == 'refs/heads/main' # Only deploy on 'main' branch - runs-on: ubuntu-latest - needs: build - steps: - - name: Download build files artifact - uses: actions/download-artifact@v4 - with: - name: build_files - - - name: Display structure of downloaded files - run: ls - - - name: Release - uses: softprops/action-gh-release@v2 - if: startsWith(github.ref, 'refs/tags/') - with: - files: | - RP2040-Decoder.bin - RP2040-Decoder.dis - RP2040-Decoder.elf - RP2040-Decoder.elf.map - RP2040-Decoder.hex - RP2040-Decoder.uf2 + \ No newline at end of file diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml new file mode 100644 index 0000000..94d1c31 --- /dev/null +++ b/.github/workflows/prerelease.yml @@ -0,0 +1,65 @@ +# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml +name: Build Software and create release on tag + +on: + push: + tags: + - "v*.*-rc" # Trigger on rc tag push + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Debug + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: install build packages + run: sudo apt-get update && sudo apt-get install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib + + - name: Get sdk and add PICO_SDK_PATH + run: cd /tmp && git clone https://github.com/raspberrypi/pico-sdk.git && echo "PICO_SDK_PATH=/tmp/pico-sdk" >> $GITHUB_ENV + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/Software/build -S ${{github.workspace}}/Software -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/Software/build --config ${{env.BUILD_TYPE}} + + - name: Upload build files as artifact + uses: actions/upload-artifact@v4 + with: + name: build_files + path: ${{github.workspace}}/Software/build + + prerelease: + if: github.ref == 'refs/heads/dev' # Only deploy on 'dev' branch + runs-on: ubuntu-latest + needs: build + steps: + - name: Download build files artifact + uses: actions/download-artifact@v4 + with: + name: build_files + + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + prerelease: true + files: | + RP2040-Decoder.bin + RP2040-Decoder.dis + RP2040-Decoder.elf + RP2040-Decoder.elf.map + RP2040-Decoder.hex + RP2040-Decoder.uf2 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..82013cf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,65 @@ +# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage. +# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml +name: Build Software and create release on tag + +on: + push: + tags: + - "v*.*" # Trigger on rc tag push + + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Debug + +jobs: + build: + # The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac. + # You can convert this to a matrix build if you need cross-platform coverage. + # See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: install build packages + run: sudo apt-get update && sudo apt-get install cmake gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib + + - name: Get sdk and add PICO_SDK_PATH + run: cd /tmp && git clone https://github.com/raspberrypi/pico-sdk.git && echo "PICO_SDK_PATH=/tmp/pico-sdk" >> $GITHUB_ENV + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: cmake -B ${{github.workspace}}/Software/build -S ${{github.workspace}}/Software -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + # Build your program with the given configuration + run: cmake --build ${{github.workspace}}/Software/build --config ${{env.BUILD_TYPE}} + + - name: Upload build files as artifact + uses: actions/upload-artifact@v4 + with: + name: build_files + path: ${{github.workspace}}/Software/build + + release: + if: github.ref == 'refs/heads/main' # Only deploy on 'main' branch + runs-on: ubuntu-latest + needs: build + steps: + - name: Download build files artifact + uses: actions/download-artifact@v4 + with: + name: build_files + + - name: Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + RP2040-Decoder.bin + RP2040-Decoder.dis + RP2040-Decoder.elf + RP2040-Decoder.elf.map + RP2040-Decoder.hex + RP2040-Decoder.uf2