this seems to work?! #930
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 firmware release bundles" | |
on: | |
push: | |
branches: | |
- '*' | |
tags: | |
- '*' | |
workflow_dispatch: | |
env: | |
ci: 1 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: "Build" | |
runs-on: "ubuntu-latest" | |
timeout-minutes: 20 | |
steps: | |
- uses: "actions/checkout@v2" | |
with: | |
fetch-depth: 0 | |
- uses: "actions/cache@v3" | |
with: | |
path: "./stm32-tools" | |
key: ${{ runner.os }}-${{ hashFiles('**/cmake/*') }}-${{ secrets.CACHE_VERSION }} | |
- name: 'CMake configure' | |
run: | | |
cmake --preset=cross . -DCMAKE_BUILD_TYPE=RelWithDebInfo | |
- name: 'Build images' | |
run: | | |
cmake --build --preset=firmware-g4 --target firmware-images firmware-applications | |
- name: 'Prep images for upload' | |
run: | | |
cmake --install ./build-cross | |
- name: 'Upload application artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: 'firmware-applications-${{github.ref_name}}' | |
path: | | |
dist/applications/* | |
- name: 'Make images contain the refname' | |
run: | | |
for distpath in ./dist/*images ; do | |
pushd $distpath | |
for imagefile in ./*.hex ; do | |
base=$(basename $imagefile .hex) | |
mv $imagefile $base-${{github.ref_name}}.hex | |
done | |
popd | |
done | |
- name: 'Upload all-images artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: 'firmware-images-${{github.ref_name}}' | |
path: | | |
dist/images/*.hex | |
- name: 'Upload robot-images artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: 'firmware-robot-images-${{github.ref_name}}' | |
path: | | |
dist/robot-images/*.hex | |
- name: 'Upload pipette-images artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: 'firmware-pipette-images-${{github.ref_name}}' | |
path: | | |
dist/pipette-images/*.hex | |
- name: 'Upload gripper-images artifact' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: 'firmware-gripper-images-${{github.ref_name}}' | |
path: | | |
dist/gripper-images/*.hex | |
release: | |
name: 'Do a release' | |
runs-on: 'ubuntu-latest' | |
timeout-minutes: 10 | |
needs: ['build'] | |
if: github.ref_type == 'tag' | |
steps: | |
- name: 'Download artifacts' | |
uses: 'actions/download-artifact@v3' | |
with: | |
path: . | |
- name: 'Create zips for each sub-artifact' | |
run: | | |
for artifactname in firmware-*-*${{github.ref_name}} ; do | |
pushd ./$artifactname | |
zip ../${artifactname}.zip ./* | |
popd | |
done | |
- name: 'Create a release' | |
uses: 'ncipollo/[email protected]' | |
with: | |
draft: true | |
generateReleaseNotes: true | |
replacesArtifacts: true | |
allowUpdates: true | |
- name: 'Add firmware category zips' | |
uses: 'ncipollo/[email protected]' | |
with: | |
artifacts: ./firmware-*-${{github.ref_name}}.zip | |
artifactContentType: application/zip | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
omitDraftDuringUpdate: true | |
omitNameDuringUpdate: true | |
omitPrereleaseDuringUpdate: true | |
- name: 'Add latest firmware images' | |
uses: 'ncipollo/[email protected]' | |
with: | |
artifacts: './firmware-*-images-${{github.ref_name}}/*.hex' | |
artifactContentType: text/plain | |
allowUpdates: true | |
omitBodyDuringUpdate: true | |
omitDraftDuringUpdate: true | |
omitNameDuringUpdate: true | |
omitPrereleaseDuringUpdate: true |