Tweaks to the release workflows #1532
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: Build/Release OpenEVSE | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
pull_request: | |
jobs: | |
debug: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dump the environment | |
run: echo "Environment variables:" && env | sort | |
- name: Dump the event | |
run: cat $GITHUB_EVENT_PATH | |
- name: Dump github.ref_name | |
run: echo "github.ref_name = '${{ github.ref_name }}'" | |
build: | |
name: Build ${{ matrix.env }} | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
env: | |
- nodemcu-32s | |
- espressif_esp-wrover-kit | |
- espressif_esp-wrover-kit_latest | |
- adafruit_huzzah32_dev | |
- adafruit_huzzah32 | |
- adafruit_featheresp32 | |
- openevse_wifi_v1 | |
- olimex_esp32-gateway-old | |
- olimex_esp32-gateway-e | |
- olimex_esp32-gateway-f | |
- olimex_esp32-gateway-e_dev | |
- olimex_esp32-gateway-f_dev | |
- olimex_esp32-poe-iso | |
- heltec_esp32-wifi-lora-v2 | |
- wt32-eth01 | |
- esp32-c3-devkitc-02 | |
- elecrow_esp32_hmi | |
# - elecrow_esp32_hmi_dev | |
- openevse_wifi_tft_v1 | |
- openevse_wifi_tft_v1_dev | |
steps: | |
- uses: ammaraskar/gcc-problem-matcher@master | |
- uses: actions/checkout@v4 | |
- name: Cache pip | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: Cache PlatformIO | |
uses: actions/cache@v4 | |
with: | |
path: ~/.platformio | |
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }} | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install PlatformIO | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade platformio | |
- name: Run PlatformIO | |
run: pio run -e ${{ matrix.env }} | |
- name: Upload output to GitHub | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.env }}.bin | |
path: .pio/build/${{ matrix.env }}/*.bin | |
release: | |
name: Upload release assets | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.ref_name == 'master' || startsWith(github.ref_name, 'v') | |
steps: | |
- name: Download the built assets | |
uses: actions/download-artifact@v4 | |
with: | |
path: artifacts | |
- name: Rename images to something more sensible | |
run: | | |
find artifacts -name 'firmware.bin' | while read -r image; do | |
dir=$(dirname "${image}") | |
board=$(basename "${dir}") | |
echo mv "$image" "$board" | |
mv "$image" "$board" | |
done | |
- name: Get the bootloader and partition files | |
run: | | |
for i in openevse_wifi_tft_v1:16mb openevse_wifi_v1:4mb; do | |
env=$(cut -f1 -d: <<< $i) | |
name=$(cut -f2 -d: <<< $i) | |
mv artifacts/$env.bin/bootloader.bin bootloader_$name.bin | |
mv artifacts/$env.bin/partitions.bin partitions_$name.bin | |
done | |
- name: Upload assets to latest release | |
if: github.ref_name == 'master' | |
uses: "softprops/action-gh-release@v2" | |
with: | |
prerelease: true | |
tag_name: latest | |
name: Development Build | |
generate_release_notes: true | |
files: | | |
*.bin | |
- name: Upload assets to release | |
if: startsWith(github.ref_name, 'v') | |
uses: "softprops/action-gh-release@v2" | |
with: | |
prerelease: true | |
name: "${{ github.ref_name }}" | |
files: | | |
*.bin |