mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-03 01:39:30 +02:00
102 lines
4.2 KiB
YAML
102 lines
4.2 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@v5
|
|
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
|
|
|
|
- name: 🛠 Build ota image for Lilygo T-CAN
|
|
run: |
|
|
pio run -e lilygo_330
|
|
cp .pio/build/lilygo_330/firmware.bin output/BE_${{ steps.vars.outputs.tag }}_LilygoT-CAN485.ota.bin
|
|
|
|
- name: 🛠 Build factory image for Lilygo T-CAN
|
|
run: |
|
|
esptool --chip esp32 merge-bin -o .pio/build/lilygo_330/factory.bin --flash-mode dio --flash-freq 40m --flash-size 4MB 0x1000 .pio/build/lilygo_330/bootloader.bin 0x8000 .pio/build/lilygo_330/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/lilygo_330/firmware.bin
|
|
mv .pio/build/lilygo_330/factory.bin output/BE_${{ steps.vars.outputs.tag }}_LilygoT-CAN485.factory.bin
|
|
|
|
- name: 🛠 Build ota image for Lilygo 2-CAN
|
|
run: |
|
|
pio run -e lilygo_2CAN_330
|
|
cp .pio/build/lilygo_2CAN_330/firmware.bin output/BE_${{ steps.vars.outputs.tag }}_LilygoT-2CAN.ota.bin
|
|
|
|
- name: 🛠 Build factory image for Lilygo 2-CAN
|
|
run: |
|
|
esptool --chip esp32 merge-bin -o .pio/build/lilygo_2CAN_330/factory.bin --flash-mode dio --flash-freq 40m --flash-size 4MB 0x1000 .pio/build/lilygo_2CAN_330/bootloader.bin 0x8000 .pio/build/lilygo_2CAN_330/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/lilygo_2CAN_330/firmware.bin
|
|
mv .pio/build/lilygo_2CAN_330/factory.bin output/BE_${{ steps.vars.outputs.tag }}_LilygoT-2CAN.factory.bin
|
|
|
|
- name: 🛠 Build ota image for Stark
|
|
run: |
|
|
pio run -e stark_330
|
|
cp .pio/build/stark_330/firmware.bin output/BE_${{ steps.vars.outputs.tag }}_StarkCMR.ota.bin
|
|
|
|
- name: 🛠 Build factory image for Stark
|
|
run: |
|
|
esptool --chip esp32 merge-bin -o .pio/build/stark_330/factory.bin --flash-mode dio --flash-freq 40m --flash-size 4MB 0x1000 .pio/build/stark_330/bootloader.bin 0x8000 .pio/build/stark_330/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/stark_330/firmware.bin
|
|
mv .pio/build/stark_330/factory.bin output/BE_${{ steps.vars.outputs.tag }}_StarkCMR.factory.bin
|
|
|
|
- name: 🌐 Deploy to Web Installer repo
|
|
env:
|
|
WEB_INSTALLER_PUSH_TOKEN: ${{ secrets.WEB_INSTALLER_PUSH_TOKEN }}
|
|
REPO_OWNER: ${{ github.repository_owner }}
|
|
run: |
|
|
git clone https://$WEB_INSTALLER_PUSH_TOKEN@github.com/$REPO_OWNER/BE-Web-Installer web-installer
|
|
cd web-installer
|
|
git config --global user.name "github-actions[bot]"
|
|
git config --global user.email "github-actions[bot]@users.noreply.github.com"
|
|
mkdir -p images/${{ steps.vars.outputs.tag }}
|
|
cp ../output/*.factory.bin images/${{ steps.vars.outputs.tag }}/
|
|
git add images
|
|
git commit -m "Deploy from GitHub Actions"
|
|
git push origin main
|
|
|
|
- name: 📡 Upload to GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
tag_name: ${{ steps.vars.outputs.tag }}
|
|
files: |
|
|
output/*.ota.bin
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|