Skip to content

Add /feature and /ship lifecycle commands (#11) #4

Add /feature and /ship lifecycle commands (#11)

Add /feature and /ship lifecycle commands (#11) #4

Workflow file for this run

name: Release
on:
push:
branches: [main]
jobs:
release:
name: Build & Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Compute version tag
id: version
run: |
YEAR=$(date -u +"%Y")
MONTH=$(date -u +"%-m")
PATCH=0
# Find next available patch number for this month
while git tag -l "v${YEAR}.${MONTH}.${PATCH}" | grep -q .; do
PATCH=$((PATCH + 1))
done
VERSION="${YEAR}.${MONTH}.${PATCH}"
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "tag=v${VERSION}" >> "$GITHUB_OUTPUT"
echo "Version: ${VERSION}"
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install PlatformIO
run: pip install platformio
- name: Cache PlatformIO
uses: actions/cache@v4
with:
path: |
~/.platformio
.pio
key: pio-${{ hashFiles('firmware/platformio.ini') }}
restore-keys: pio-
- name: Inject version into firmware
run: |
sed -i 's/#define FIRMWARE_VERSION "dev"/#define FIRMWARE_VERSION "${{ steps.version.outputs.version }}"/' firmware/src/config.h
- name: Build firmware
run: pio run -e wt32_sc01_plus
working-directory: firmware
- name: Build LittleFS image
run: pio run -e wt32_sc01_plus --target buildfs
working-directory: firmware
- name: Collect artifacts
run: |
mkdir -p release
VERSION="${{ steps.version.outputs.version }}"
cp firmware/.pio/build/wt32_sc01_plus/firmware.bin "release/pitclaw-firmware-${VERSION}.bin"
cp firmware/.pio/build/wt32_sc01_plus/littlefs.bin "release/pitclaw-littlefs-${VERSION}.bin"
# Generate SHA-256 checksums
cd release
sha256sum "pitclaw-firmware-${VERSION}.bin" > "pitclaw-firmware-${VERSION}.sha256"
sha256sum "pitclaw-littlefs-${VERSION}.bin" > "pitclaw-littlefs-${VERSION}.sha256"
cd ..
# Include STL files if they exist
if ls enclosure/stl/*.stl 1>/dev/null 2>&1; then
cp enclosure/stl/*.stl release/
fi
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: Pit Claw ${{ steps.version.outputs.tag }}
generate_release_notes: true
files: release/*