CI: add version tag and firwmare version to plugin name #10
This file contains 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 release MetaModule plugin | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
SDK_branch: | ||
description: 'MetaModule SDK branch' | ||
required: true | ||
type: choice | ||
options: | ||
- main | ||
- v2.0-dev | ||
do_release: | ||
description: 'Create Release (must also select Tag above!")' | ||
required: true | ||
default: false | ||
type: boolean | ||
jobs: | ||
env: | ||
FW_VERSION: ${{ inputs.SDK_branch == 'v2.0-dev' && '-dev-12' || '' }} | ||
build-lin: | ||
strategy: | ||
matrix: | ||
gcc: ['12.3.Rel1'] # can add other versions if needed | ||
name: "Build firmware on linux" | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Install Arm GNU Toolchain (arm-none-eabi-gcc) | ||
uses: carlosperate/arm-none-eabi-gcc-action@v1 | ||
with: | ||
release: ${{ matrix.gcc }} | ||
- name: Install cmake | ||
uses: jwlawson/[email protected] | ||
with: | ||
cmake-version: '3.26.x' | ||
- name: Git setup | ||
run: git config --global --add safe.directory '*' | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: 'recursive' | ||
- name: Install linux dependencies | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install ninja-build | ||
- name: Set Release Version | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: FranzDiebold/github-env-vars-action@v2 | ||
- name: Build | ||
run: | | ||
mkdir -p metamodule-plugins | ||
git clone -b ${{ inputs.SDK_branch }} https://github.com/4ms/metamodule-plugin-sdk --recursive | ||
cmake -B build -G Ninja -DMETAMODULE_SDK_DIR=metamodule-plugin-sdk | ||
cmake --build build | ||
# Add version tag and required firmware version to the plugin file name: | ||
cd metamodule-plugins && for f in *.mmplugin; do mv $f ${f%.mmplugin}-${{ env.CI_REF_NAME }}${{ env.FW_VERSION }}.mmplugin; done; | ||
- name: Release | ||
if: startsWith(github.ref, 'refs/tags/') && ${{ inputs.do_release }} | ||
uses: softprops/action-gh-release@v2 | ||
with: | ||
name: "Release: ${{ env.CI_REF_NAME }}" | ||
files: | | ||
metamodule-plugins/*.mmplugin | ||