Battery-Emulator/.github/workflows/release-assets.yml
2025-08-08 00:36:01 +03:00

72 lines
1.8 KiB
YAML

name: Release Assets
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g. v1.0.0)'
required: true
jobs:
build-and-upload:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Set release tag
id: vars
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "tag=${{ inputs.tag }}" >> "$GITHUB_OUTPUT"
else
echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT"
fi
- name: Checkout code at tag
uses: actions/checkout@v4
with:
ref: refs/tags/${{ steps.vars.outputs.tag }}
- name: Build artifacts
run: |
mkdir output
echo "Built for tag ${{ steps.vars.outputs.tag }}" > output/info.txt
- uses: actions/cache@v4
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install PlatformIO Core
run: pip install --upgrade platformio
# Copy USER_SECRETS.TEMPLATE.h to USER_SECRETS.h
- name: Copy USER_SECRETS.TEMPLATE.h to USER_SECRETS.h
run: cp ./Software/USER_SECRETS.TEMPLATE.h ./Software/USER_SECRETS.h
- name: Build image for Lilygo
run: |
pio run -e lilygo_330
mkdir -p output
mv .pio/build/lilygo_330/firmware.bin output/lilygo.bin
- name: Build image for Stark
run: |
pio run -e stark_330
mv .pio/build/stark_330/firmware.bin output/stark.bin
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.vars.outputs.tag }}
files: |
output/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}