feat(gha): Auto-publish releases

- GHA release workflow is updated to use an action for uploading all assets. The
	action docs say it updates a release if one already exists, and since this
	triggers on release and we pass a release tag we know the release already
	exists.
- GHA release candidate workflow is updated to auto-publish a pre-release
	release on push to a `release/**` branch. A script is added and used to
	generate a release message made up of the commits since the last release of
	any kind.
- ACT profiles are added to allow locally testing these workflows without
	needing to push and wait for GHA to run.
- Docs are updated to note how to test the workflows locally.
This commit is contained in:
Joel Goguen
2026-04-23 22:48:41 -04:00
parent 5d0620bc3a
commit 0010b200ed
7 changed files with 423 additions and 47 deletions
+15 -39
View File
@@ -3,6 +3,9 @@ on:
release:
types: [published]
permissions:
contents: write
jobs:
build-release:
runs-on: ubuntu-latest
@@ -14,7 +17,7 @@ jobs:
- uses: actions/setup-python@v6
with:
python-version: '3.14'
python-version: "3.14"
- name: Install uv
uses: astral-sh/setup-uv@v7
@@ -31,42 +34,15 @@ jobs:
- name: Patch min_chip_rev_full to 0
run: python3 scripts/patch_min_chip_rev.py .pio/build/gh_release/firmware.bin
- name: Upload bootloader.bin to Release
uses: actions/upload-release-asset@v1
- name: Upload release assets
if: ${{ env.ACT != 'true' }}
uses: softprops/action-gh-release@v2
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: .pio/build/gh_release/bootloader.bin
asset_name: bootloader.bin
asset_content_type: application/octet-stream
- name: Upload firmware.bin to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: .pio/build/gh_release/firmware.bin
asset_name: firmware.bin
asset_content_type: application/octet-stream
- name: Upload firmware.elf to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: .pio/build/gh_release/firmware.elf
asset_name: firmware.elf
asset_content_type: application/octet-stream
- name: Upload firmware.map to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: .pio/build/gh_release/firmware.map
asset_name: firmware.map
asset_content_type: application/octet-stream
- name: Upload partitions.bin to Release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: .pio/build/gh_release/partitions.bin
asset_name: partitions.bin
asset_content_type: application/octet-stream
tag_name: ${{ github.event.release.tag_name }}
files: |
.pio/build/gh_release/bootloader.bin
.pio/build/gh_release/firmware.bin
.pio/build/gh_release/firmware.elf
.pio/build/gh_release/firmware.map
.pio/build/gh_release/partitions.bin
fail_on_unmatched_files: true
+32 -8
View File
@@ -1,20 +1,25 @@
name: Compile Release Candidate
name: Publish Release Candidate
on:
workflow_dispatch:
push:
branches:
- "release/**"
permissions:
contents: write
jobs:
build-release-candidate:
if: startsWith(github.ref_name, 'release/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- uses: actions/setup-python@v6
with:
python-version: '3.14'
python-version: "3.14"
- name: Install uv
uses: astral-sh/setup-uv@v7
@@ -29,6 +34,8 @@ jobs:
run: |
echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
echo "BRANCH_SUFFIX=${GITHUB_REF_NAME#release/}" >> $GITHUB_ENV
echo "RC_TAG=${GITHUB_REF_NAME#release/}-rc.${GITHUB_RUN_NUMBER}.${GITHUB_RUN_ATTEMPT}" >> $GITHUB_ENV
echo "RELEASE_NOTES_PATH=${RUNNER_TEMP}/release-notes.md" >> $GITHUB_ENV
- name: Build CrossPoint Release Candidate
env:
@@ -38,13 +45,30 @@ jobs:
- name: Patch min_chip_rev_full to 0
run: python3 scripts/patch_min_chip_rev.py .pio/build/gh_release_rc/firmware.bin
- name: Upload Artifacts
uses: actions/upload-artifact@v4
- name: Generate release notes
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
python3 scripts/generate_release_notes.py \
--output "${RELEASE_NOTES_PATH}" \
--target-sha "${GITHUB_SHA}" \
--current-label "${RC_TAG}" \
--release-scope any \
--exclude-tag "${RC_TAG}"
- name: Publish prerelease assets
if: ${{ env.ACT != 'true' }}
uses: softprops/action-gh-release@v2
with:
name: CrossPoint-RC-${{ env.BRANCH_SUFFIX }}
path: |
tag_name: ${{ env.RC_TAG }}
target_commitish: ${{ github.sha }}
name: CrossPoint ${{ env.RC_TAG }}
body_path: ${{ env.RELEASE_NOTES_PATH }}
prerelease: true
files: |
.pio/build/gh_release_rc/bootloader.bin
.pio/build/gh_release_rc/firmware.bin
.pio/build/gh_release_rc/firmware.elf
.pio/build/gh_release_rc/firmware.map
.pio/build/gh_release_rc/partitions.bin
fail_on_unmatched_files: true