Skip to content

Commit c71bca6

Browse files
committed
ci: Attach firmware hex and bin to GitHub releases.
1 parent d3230d8 commit c71bca6

2 files changed

Lines changed: 58 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ jobs:
1616
issues: write
1717
pull-requests: write
1818
id-token: write
19+
outputs:
20+
new-release-published: ${{ steps.semantic.outputs.new-release-published }}
21+
new-release-version: ${{ steps.semantic.outputs.new-release-version }}
1922
steps:
2023
- name: Generate token
2124
id: generate_token
@@ -37,7 +40,60 @@ jobs:
3740
- run: npm ci
3841

3942
- name: Run semantic-release
43+
id: semantic
4044
env:
4145
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
4246
HUSKY: "0"
4347
run: npx semantic-release
48+
49+
firmware:
50+
name: Build and attach firmware
51+
needs: release
52+
if: needs.release.outputs.new-release-published == 'true'
53+
runs-on: ubuntu-latest
54+
permissions:
55+
contents: write
56+
env:
57+
BOARD: STEAM32_WB55RG
58+
MICROPYTHON_REPO: https://github.com/steamicc/micropython-steami.git
59+
MICROPYTHON_BRANCH: stm32-steami-rev1d-final
60+
steps:
61+
- name: Generate token
62+
id: generate_token
63+
uses: tibdex/github-app-token@v2
64+
with:
65+
app_id: ${{ secrets.RELEASE_APP_ID }}
66+
private_key: ${{ secrets.RELEASE_APP_SECRET }}
67+
68+
- uses: actions/checkout@v4
69+
with:
70+
ref: v${{ needs.release.outputs.new-release-version }}
71+
72+
- name: Install ARM toolchain
73+
run: |
74+
sudo apt-get update
75+
sudo apt-get install -y --no-install-recommends gcc-arm-none-eabi libnewlib-arm-none-eabi
76+
77+
- name: Clone MicroPython
78+
run: |
79+
git clone --branch $MICROPYTHON_BRANCH $MICROPYTHON_REPO .build/micropython-steami
80+
cd .build/micropython-steami/ports/stm32 && make BOARD=$BOARD submodules
81+
82+
- name: Build firmware
83+
run: |
84+
rm -rf .build/micropython-steami/lib/micropython-steami-lib
85+
ln -s $GITHUB_WORKSPACE .build/micropython-steami/lib/micropython-steami-lib
86+
cd .build/micropython-steami/ports/stm32 && make BOARD=$BOARD
87+
88+
- name: Attach firmware to release
89+
env:
90+
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
91+
run: |
92+
VERSION="v${{ needs.release.outputs.new-release-version }}"
93+
BUILD_DIR=".build/micropython-steami/ports/stm32/build-${BOARD}"
94+
cp "${BUILD_DIR}/firmware.hex" "steami-firmware-${VERSION}.hex"
95+
cp "${BUILD_DIR}/firmware.bin" "steami-firmware-${VERSION}.bin"
96+
gh release upload "$VERSION" \
97+
"steami-firmware-${VERSION}.hex" \
98+
"steami-firmware-${VERSION}.bin" \
99+
--clobber

.releaserc.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
"changelogTitle": "# Changelog\n\nAll notable changes to this project will be documented in this file.\nSee [Conventional Commits](https://conventionalcommits.org) for commit guidelines."
2525
}],
2626
["@semantic-release/exec", {
27-
"prepareCmd": "sed -i 's/^version = \".*\"/version = \"${nextRelease.version}\"/' pyproject.toml"
27+
"prepareCmd": "sed -i 's/^version = \".*\"/version = \"${nextRelease.version}\"/' pyproject.toml",
28+
"publishCmd": "echo new-release-published=true >> $GITHUB_OUTPUT && echo new-release-version=${nextRelease.version} >> $GITHUB_OUTPUT"
2829
}],
2930
["@semantic-release/git", {
3031
"assets": ["CHANGELOG.md", "pyproject.toml"],

0 commit comments

Comments
 (0)