Skip to content

V/0.0.14 (#34)

V/0.0.14 (#34) #31

Workflow file for this run

name: Release
permissions:
contents: write
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Cache Dependencies
uses: actions/cache@v3
with:
path: |
~/.cache/pip
~/.platformio/.cache
key: ${{ runner.os }}-pio-${{ hashFiles('**/*.lock') }}
restore-keys: |
${{ runner.os }}-pio-
- name: Set Up Python
uses: actions/setup-python@v3
with:
python-version: "3.9"
- name: Install PlatformIO Core
run: pip install --upgrade platformio
- name: Adjust INI for Release
run: sh .github/scripts/release.sh
- name: Build PlatformIO Project
run: pio run
- name: Archive Artifacts
run: |
mkdir -p artifacts
# Define the mapping of board names to file prefixes
declare -A board_map=(
["esp8266"]="0x0000_firmware"
["geekmagic-smalltv"]="0x0000_firmware"
["esp32"]="0x10000_firmware 0x1000_bootloader 0x8000_partitions"
["esp32-s2"]="0x10000_firmware 0x1000_bootloader 0x8000_partitions"
["esp32-s3"]="0x10000_firmware 0x1000_bootloader 0x8000_partitions"
["lilygo-t-display-s3"]="0x10000_firmware 0x1000_bootloader 0x8000_partitions"
)
# Iterate through each board and copy corresponding files
for board in "${!board_map[@]}"; do
for file_type in ${board_map[$board]}; do
find .pio/build -name "${file_type}.bin" -exec sh -c 'cp "{}" "artifacts/'"${board_map[$board]}"'_$(basename $(dirname {})).bin"' \;
done
done
working-directory: ${{ github.workspace }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: builded-artifacts
path: artifacts/*
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Extract Version from leafminer.h
id: extract_version
run: echo "::set-output name=version::$(grep -o '_VERSION "[^"]*' src/leafminer.h | cut -d'"' -f2)"
- name: Create GitHub Release
run: gh release create v${{ steps.extract_version.outputs.version }} -t "Release ${{ steps.extract_version.outputs.version }}" -n "Release ${{ steps.extract_version.outputs.version }}" -F CHANGELOG.md
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
name: builded-artifacts
path: artifacts
- name: Upload Artifacts to Release
run: |
for file in artifacts/*.bin; do
gh release upload v${{ steps.extract_version.outputs.version }} "$file" --clobber;
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}