Build IDF Monitor #3
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 IDF Monitor | |
| on: [push, pull_request] | |
| jobs: | |
| build-idf-monitor-binaries: | |
| name: Build IDF Monitor binaries for ${{ matrix.platform }} | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [windows-amd64, linux-amd64, macos-amd64, macos-arm64, linux-armv7, linux-aarch64] | |
| include: | |
| - platform: windows-amd64 | |
| runner: windows-latest | |
| - platform: linux-amd64 | |
| runner: ubuntu-24.04 | |
| - platform: macos-amd64 | |
| runner: macos-13 | |
| - platform: macos-arm64 | |
| runner: macos-latest | |
| - platform: linux-armv7 | |
| runner: ubuntu-latest | |
| - platform: linux-aarch64 | |
| runner: ubuntu-24.04-arm | |
| env: | |
| DISTPATH: idf-monitor-${{ matrix.platform }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v5 | |
| # Python is not needed for Linux runners, as they are running in a container | |
| if: matrix.platform != 'linux-armv7' && matrix.platform != 'linux-aarch64' && matrix.platform != 'linux-amd64' | |
| with: | |
| python-version: "3.13" | |
| cache: pip | |
| - name: Build with PyInstaller | |
| uses: espressif/python-binary-action@master | |
| with: | |
| scripts: 'esp_idf_monitor/__main__.py' | |
| script-name: 'esp_idf_monitor' | |
| output-dir: ./${{ env.DISTPATH }} | |
| target-platform: ${{ matrix.platform }} | |
| - name: Add license and readme | |
| shell: bash | |
| run: mv LICENSE README.md ./${{ env.DISTPATH }} | |
| - name: Archive artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.DISTPATH }} | |
| path: ${{ env.DISTPATH }} | |
| create_release: | |
| name: Create GitHub release | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: build-idf-monitor-binaries | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Get version | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| shell: bash | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install --user -e ".[dev]" | |
| - name: Generate changelog | |
| run: | | |
| cz changelog ${{ steps.get_version.outputs.VERSION }} --file-name changelog_body.md | |
| cat changelog_body.md | |
| - name: Download built binaries | |
| uses: actions/download-artifact@v4 | |
| - name: Compress and rename binaries | |
| run: | | |
| for dir in idf-monitor-*; do | |
| if [[ "$dir" == idf-monitor-win* ]]; then | |
| zip -r "idf-monitor-v${{ steps.get_version.outputs.VERSION }}-${dir#idf-monitor-}.zip" "$dir" | |
| else | |
| chmod -R u=rwx,g=rx,o=rx "$dir" | |
| tar -cvzf "idf-monitor-v${{ steps.get_version.outputs.VERSION }}-${dir#idf-monitor-}.tar.gz" "$dir" | |
| fi | |
| done | |
| - name: Create release | |
| id: create_release | |
| uses: softprops/action-gh-release@v2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| body_path: changelog_body.md | |
| name: Version ${{ steps.get_version.outputs.VERSION }} | |
| draft: true | |
| prerelease: false | |
| files: | | |
| idf-monitor-v${{ steps.get_version.outputs.VERSION }}-*.zip | |
| idf-monitor-v${{ steps.get_version.outputs.VERSION }}-*.tar.gz |