Fix Upload Firmware batch file path to tools subdirectory (#2) #2
Workflow file for this run
This file contains hidden or 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
| name: Build and Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Full history for changelog | |
| - name: Validate tag format | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then | |
| echo "ERROR: Tag must match semantic version format (v1.2.3)" | |
| exit 1 | |
| fi | |
| echo "TAG=$TAG" >> $GITHUB_ENV | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install arduino-cli | |
| run: | | |
| curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh | |
| echo "$PWD/bin" >> $GITHUB_PATH | |
| - name: Install ESP32 platform and dependencies | |
| run: | | |
| ${{ github.workspace }}/bin/arduino-cli config init | |
| ${{ github.workspace }}/bin/arduino-cli config add board_manager.additional_urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json | |
| ${{ github.workspace }}/bin/arduino-cli core update-index | |
| ${{ github.workspace }}/bin/arduino-cli core install esp32:esp32 | |
| ${{ github.workspace }}/bin/arduino-cli lib install "LiquidCrystal" | |
| - name: Build release package | |
| run: | | |
| chmod +x build_release.sh | |
| ./build_release.sh "$TAG" | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| # Get previous tag | |
| PREV_TAG=$(git describe --tags --abbrev=0 "$TAG^" 2>/dev/null || echo "") | |
| if [ -n "$PREV_TAG" ]; then | |
| echo "## Changes since $PREV_TAG" > CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| git log --pretty=format:"- %s (%h)" "$PREV_TAG..$TAG" >> CHANGELOG.md | |
| else | |
| echo "## Initial Release" > CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "First release of SledLink firmware and tools." >> CHANGELOG.md | |
| fi | |
| echo "" >> CHANGELOG.md | |
| echo "## Installation" >> CHANGELOG.md | |
| echo "" >> CHANGELOG.md | |
| echo "1. Download \`SledLink-$TAG.zip\` below" >> CHANGELOG.md | |
| echo "2. Unzip the package" >> CHANGELOG.md | |
| echo "3. See \`UPLOAD_GUIDE.md\` in the package for installation instructions" >> CHANGELOG.md | |
| cat CHANGELOG.md | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: SledLink ${{ env.TAG }} | |
| body_path: CHANGELOG.md | |
| files: | | |
| release/SledLink-${{ env.TAG }}.zip | |
| draft: false | |
| prerelease: ${{ contains(env.TAG, '-') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-package | |
| path: release/SledLink-${{ env.TAG }}.zip | |
| retention-days: 30 |