Build and create a release when tag is pushed #33
Workflow file for this run
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: Build and create a release when tag is pushed | |
| # Only deploy when a new tag is pushed | |
| # git tag v0.n | |
| # git push origin v0.n | |
| on: | |
| push: | |
| tags: | |
| - "v*.*-alpha" | |
| - "v*.*.*" | |
| - "v*.*" | |
| workflow_dispatch: | |
| # Must match the project() name in CMakeLists.txt | |
| env: | |
| APP_NAME: picosmsPlus | |
| # Allow this workflow to write back to the repository | |
| permissions: | |
| contents: write | |
| # Build binaries and create release | |
| jobs: | |
| build-release: | |
| runs-on: self-hosted | |
| name: Build and create release | |
| steps: | |
| - name: Check out this repository with submodules | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Update line containing pico_set_program_version() in CMakelists.txt with tag name. | |
| run: | | |
| # Extract the tag name that triggered the event and remove the 'refs/tags/' prefix | |
| arm-none-eabi-gcc --version | |
| input_string=${{ github.ref }} | |
| prefix="refs/tags/" | |
| tag="No versioninfo found" | |
| if [[ $input_string == $prefix* ]]; then | |
| echo "The string starts with 'refs/tags/'." | |
| tag="${input_string#$prefix}" | |
| echo "Tag is ${tag}" | |
| sed -i "s/^[[:space:]]*pico_set_program_version(.*/pico_set_program_version(${{ env.APP_NAME }} \"$tag\")/" CMakeLists.txt | |
| sed -i "s/VX.X/$tag/" pico_shared/menu.h | |
| else | |
| echo "The string does not start with 'refs/tags/'." | |
| fi | |
| grep "pico_set_program_version" CMakeLists.txt | |
| grep SWVERSION pico_shared/menu.h | |
| - name: Build all the .uf2 files | |
| run: | | |
| chmod +x build*.sh bld.sh || exit 1 | |
| export PICO_SDK_PATH=$HOME/pico-sdk | |
| ./buildAll.sh | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' | |
| with: | |
| files: | | |
| releases/*.uf2 | |
| PCB/pico_nesPCB_v2.1.zip | |
| body_path: CHANGELOG.md | |