Skip to content

add isReleaseTag to call upload-release-asset workflow #156

add isReleaseTag to call upload-release-asset workflow

add isReleaseTag to call upload-release-asset workflow #156

#------------------------------------------------------
# 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
outputs:
release-tag-condition-matched: ${{ steps.release-tag-condition.outputs.matched }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Check if Release Tag Condition Matched
id: release-tag-condition
run: |
if [[ ${{ github.ref_type }} == 'tag' && ${{ github.ref_name }} =~ ^v[0-9]+.[0-9]+.[0-9]+$ ]]; then
echo "matched=true" >> $GITHUB_OUTPUT
else
echo "matched=false" >> $GITHUB_OUTPUT
fi
- name: Generate version string
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
call-upload-release-asset:
needs: [build-and-upload]
if: ${{ needs.build-and-upload.outputs.release-tag-condition-matched == 'true' }}
uses: ./.github/workflows/upload-release-asset.yml
with:
source_run_id: ${{ github.run_id }}