Skip to content

PlatformIO Build and Release #5

PlatformIO Build and Release

PlatformIO Build and Release #5

name: PlatformIO Build and Release
on:
workflow_dispatch:
jobs:
build-and-release:
runs-on: ubuntu-latest
steps:
# Checkout repository
- uses: actions/checkout@v3
# Cache dependencies
- uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio
# Setup Python environment
- uses: actions/setup-python@v4
with:
python-version: '3.11'
# Install PlatformIO Core
- name: Install PlatformIO Core
run: pip install --upgrade platformio
# Build PlatformIO Project for M4 and M7
- name: Build M4 and M7 Firmware
run: |
cd ./m4 && pio run && cd ../m7 && pio run
# Rename firmware files
- name: Rename Firmware Files
run: |
mkdir -p firmware
mv ./m4/.pio/build/giga_r1_m4_new_hardware/firmware.bin ./firmware/firmwareM4_new_hardware.bin
mv ./m4/.pio/build/giga_r1_m4_new_shield_old_hardware/firmware.bin ./firmware/firmwareM4_new_shield_old_hardware.bin
mv ./m4/.pio/build/giga_r1_m4_old_hardware/firmware.bin ./firmware/firmwareM4_old_hardware.bin
mv ./m7/.pio/build/giga_r1_m7/firmware.bin ./firmware/firmwareM7.bin
# Clone the firmware uploader repository
- name: Clone Firmware Uploader Repo
run: |
git clone https://github.com/afylab/firmware_uploader.git
cd firmware_uploader
rm -f firmware/*.bin
cp ../firmware/*.bin firmware/
rm -rf .git
# Create a zip archive
- name: Create Zip Archive
run: |
zip -r Firmware_Package.zip firmware_uploader
# Create GitHub Release
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Firmware Uploader Package v${{ github.run_number }}
body: |
This release includes the updated firmware files and firmware uploader package.
draft: true
prerelease: false
# Upload release asset
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Firmware_Package.zip
asset_name: Firmware_Package.zip
asset_content_type: application/zip