Files
Crosspoint/.github/workflows/release_candidate.yml
T

107 lines
3.0 KiB
YAML

name: Publish Release Candidate
on:
push:
branches:
- "release/**"
permissions:
contents: write
jobs:
build-release-candidate:
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"
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "latest"
enable-cache: false
- name: Install PlatformIO Core
run: uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.19.zip
- name: Extract env
run: |
VERSION="$(python3 - <<'PY'
import configparser
config = configparser.ConfigParser()
config.read("platformio.ini")
version = config["crosspoint"]["version"].strip()
if version.count(".") == 1:
version = f"{version}.0"
print(version)
PY
)"
NEXT_RC="$(python3 - "$VERSION" <<'PY'
import re
import subprocess
import sys
version = sys.argv[1]
pattern = re.compile(rf"^{re.escape(version)}-rc\.(\d+)(?:\.\d+)?$")
highest = 0
tags = subprocess.check_output(
["git", "tag", "-l", f"{version}-rc.*"],
text=True,
)
for tag in tags.splitlines():
match = pattern.match(tag)
if match:
highest = max(highest, int(match.group(1)))
print(highest + 1)
PY
)"
echo "RC_TAG=${VERSION}-rc.${NEXT_RC}" >> $GITHUB_ENV
echo "RELEASE_NOTES_PATH=${RUNNER_TEMP}/release-notes.md" >> $GITHUB_ENV
- name: Build CrossPoint Release Candidate
env:
CROSSPOINT_RC_VERSION: ${{ env.RC_TAG }}
run: pio run -e gh_release_rc
- name: Patch min_chip_rev_full to 0
run: python3 scripts/patch_min_chip_rev.py .pio/build/gh_release_rc/firmware.bin
- 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:
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