add upload-release-asset.yml workflow #137
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
| #------------------------------------------------------ | |
| # Copyright (c) 2025, Elehobica | |
| # Released under the BSD-2-Clause | |
| # refer to https://opensource.org/licenses/BSD-2-Clause | |
| #------------------------------------------------------ | |
| name: Build | |
| on: [push, pull_request] | |
| jobs: | |
| build-and-upload: | |
| runs-on: ubuntu-latest | |
| env: | |
| RELEASE_DIR: Release | |
| VERSION_LENGTH: 15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Generate version stirng | |
| id: generate-version-string | |
| run: | | |
| ref_name=${{ github.ref_name }} | |
| if [[ ${{ github.ref_type }} == 'branch' ]]; then | |
| run_number=-${{ github.run_number }} | |
| run_number_length=${#run_number} | |
| ref_max_length=$((${{ env.VERSION_LENGTH }} - run_number_length)) | |
| else | |
| run_number= | |
| ref_max_length=${{ env.VERSION_LENGTH }} | |
| fi | |
| echo "value=${ref_name:0:$ref_max_length}${run_number}" >> $GITHUB_OUTPUT | |
| - name: Set Version | |
| uses: ./.github/actions/set-version | |
| with: | |
| target: src/ConfigParam.h | |
| version_str: ${{ steps.generate-version-string.outputs.value }} | |
| version_str_size: ${{ env.VERSION_LENGTH }} | |
| - name: Build Pico | |
| uses: ./.github/actions/build-and-rename | |
| with: | |
| path: . | |
| build: build | |
| identifier: pico | |
| output_path: ${{ env.RELEASE_DIR }} | |
| - name: Build Pico 2 | |
| uses: ./.github/actions/build-and-rename | |
| with: | |
| path: . | |
| build: build2 | |
| platform: rp2350 | |
| board: pico2 | |
| identifier: pico2 | |
| output_path: ${{ env.RELEASE_DIR }} | |
| - name: Upload production artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist-binaries | |
| path: | | |
| ${{ env.RELEASE_DIR }}/*.uf2 | |
| ${{ env.RELEASE_DIR }}/*.elf | |
| upload-release-asset: | |
| needs: [build-and-upload] | |
| if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }} | |
| uses: ./.github/workflows/upload-release-asset.yml | |
| with: | |
| source_run_id: ${{ github.run_id }} |