Merge pull request #705 from ikishk/develop #195
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 | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache PlatformIO | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.platformio | |
| key: ${{ runner.os }}-platformio-${{ hashFiles('platformio.ini') }} | |
| restore-keys: | | |
| ${{ runner.os }}-platformio- | |
| - name: Ensure changelog is updated | |
| uses: dangoslen/changelog-enforcer@v3.6.1 | |
| - name: Set up python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| architecture: 'x64' | |
| - name: Upgrade pip tooling | |
| run: | | |
| python -m pip install --upgrade pip setuptools wheel | |
| - name: Get current date | |
| id: date | |
| run: echo "date=$(date +'%y.%-m.%-d')" >> $GITHUB_OUTPUT | |
| - name: Test with environment variables | |
| run: echo $TAG_NAME - $RELEASE_NAME | |
| env: | |
| TAG_NAME: ${{ steps.date.outputs.date }} | |
| RELEASE_NAME: ${{ steps.date.outputs.date }}- | |
| - uses: rickstaa/action-create-tag@v1 | |
| with: | |
| tag: ${{ steps.date.outputs.date }} | |
| message: "Automatic release ${{ steps.date.outputs.date }}" | |
| - uses: dorny/paths-filter@v3 | |
| id: changes | |
| with: | |
| filters: | | |
| software: | |
| - '!(Hardware/**)' | |
| hardware: | |
| - 'Hardware/**' | |
| - name: Show python version | |
| run: python --version | |
| - name: Install PlatformIO | |
| run: python -m pip install platformio | |
| - name: Pre-install PlatformIO packages (release env) | |
| run: platformio pkg install -e release | |
| - name: Ensure ESP-IDF component manager is available | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| PIO_HOME="$HOME/.platformio" | |
| # Try to locate PlatformIO-managed ESP-IDF virtualenv | |
| ESPIDF_VENV=$(ls -d "$PIO_HOME/penv/.espidf-"* 2>/dev/null | head -n 1 || true) | |
| if [ -z "$ESPIDF_VENV" ]; then | |
| # Trigger framework fetch which usually creates the venv | |
| platformio platform show espressif32 || true | |
| ESPIDF_VENV=$(ls -d "$PIO_HOME/penv/.espidf-"* 2>/dev/null | head -n 1 || true) | |
| fi | |
| if [ -n "$ESPIDF_VENV" ] && [ -x "$ESPIDF_VENV/bin/python" ]; then | |
| "$ESPIDF_VENV/bin/python" -m pip install --upgrade pip setuptools wheel | |
| "$ESPIDF_VENV/bin/python" -m pip install --upgrade idf-component-manager | |
| else | |
| echo "ESP-IDF venv not found yet; proceeding. PlatformIO should install deps during build." | |
| fi | |
| - name: Check pre-commit hooks | |
| uses: pre-commit/action@v3.0.1 | |
| - name: Build firmware | |
| run: platformio run -e release | |
| - name: Build filesystem | |
| run: platformio run -e release --target buildfs | |
| - name: Create artifacts | |
| run: | | |
| 7z a SmartSpin2kFirmware-${{ steps.date.outputs.date }}.bin.zip ./.pio/build/release/*.bin | |
| - name: Archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: all-artifacts | |
| path: SmartSpin2kFirmware-${{ steps.date.outputs.date }}.bin.zip | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v5 | |
| with: | |
| name: all-artifacts | |
| - name: Get tag info | |
| id: tag_info | |
| run: echo "SOURCE_TAG=${{ steps.date.outputs.date }}" >> $GITHUB_OUTPUT | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.tag_info.outputs.SOURCE_TAG }} | |
| name: SmartSpin2k ${{ steps.tag_info.outputs.SOURCE_TAG }} | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| body: ${{ github.event.head_commit.message }} | |
| files: | | |
| SmartSpin2kFirmware-${{ steps.date.outputs.date }}.bin.zip | |
| update-changelog: | |
| - name: Update changelog | |
| uses: thomaseizinger/keep-a-changelog-new-release@v3 | |
| with: | |
| version: ${{ steps.date.outputs.date }} | |