Add release workflow #50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Firmware | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - '[0-9]+.[0-9]+.[0-9]+' # Match semantic versioning tags | |
| branches: | |
| - main | |
| - master | |
| - dev | |
| - '[0-9]*.[0-9]*.[0-9]*_Dev' | |
| - '[0-9]*.[0-9]*_Dev' | |
| paths-ignore: | |
| - '*.md' | |
| env: | |
| CMAKE_PREFIX_PATH: /opt/toolchains | |
| jobs: | |
| generate_outputs: | |
| runs-on: ubuntu-24.04 | |
| container: ghcr.io/zephyrproject-rtos/ci:v0.27.4 | |
| strategy: | |
| matrix: | |
| built_type: [debug, release] | |
| board: [beelight@1/nrf54l15/cpuapp] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| path: BeeLight | |
| submodules: recursive | |
| - name: Dependencies | |
| run: | | |
| wget https://sourceforge.net/projects/astyle/files/astyle/astyle%203.4/astyle-3.4.10.tar.bz2/download -O astyle.tar.bz2 | |
| tar -xf astyle.tar.bz2 | |
| cd astyle-3.4.10 | |
| mkdir -p as-gcc-exe | |
| cd as-gcc-exe | |
| cmake ../ | |
| make | |
| make install | |
| - name: Initialize | |
| working-directory: BeeLight/firmware/app | |
| run: | | |
| west init -l . | |
| west config manifest.group-filter +bsec | |
| west update | |
| mkdir -p fw_images | |
| - name: Style | |
| working-directory: BeeLight/firmware/app | |
| run: | | |
| west format --dry-run | |
| - name: Define build directory name | |
| working-directory: BeeLight/firmware/app | |
| run: | | |
| # Since board name contains slashes, we need to replace them with underscores | |
| # as the board name is used as part of the build directory name. | |
| # It's output to GITHUB_ENV so it can be used in the next steps | |
| # and only needs to be calculated once. | |
| BUILD_DIR=${{ matrix.board }}_${{ matrix.built_type }} | |
| echo "BUILD_DIR=${BUILD_DIR}" | sed 's/\//_/g' >> ""${GITHUB_ENV}"" | |
| - name: Build firmware | |
| env: | |
| BUILD_DIR: ${{ env.BUILD_DIR }} | |
| working-directory: BeeLight/firmware/app | |
| run: | | |
| set -e | |
| west build --build-dir "${{ env.BUILD_DIR }}" --pristine --board "${{ matrix.board }}" -- -DNCS_TOOLCHAIN_VERSION=NONE -DCONF_FILE="config/${{ matrix.built_type }}.conf" -DBOARD_ROOT=. | |
| src_hex="" | |
| if [ -f "${{ env.BUILD_DIR }}/merged.hex" ]; then src_hex="${{ env.BUILD_DIR }}/merged.hex"; fi | |
| if [ -z "$src_hex" ] && [ -f "${{ env.BUILD_DIR }}/zephyr/merged.hex" ]; then src_hex="${{ env.BUILD_DIR }}/zephyr/merged.hex"; fi | |
| if [ -n "$src_hex" ]; then cp "$src_hex" "fw_images/${{ matrix.built_type }}.hex"; else echo "merged.hex not found, skipping"; fi | |
| - name: Upload Firmware | |
| env: | |
| BUILD_DIR: ${{ env.BUILD_DIR }} | |
| uses: actions/upload-artifact@v4.3.3 | |
| with: | |
| name: ${{ env.BUILD_DIR }} | |
| path: | | |
| BeeLight/firmware/app/fw_images | |
| if-no-files-found: ignore |