name: Compile Release # Build and attach firmware only after a release is published. The release tag # supplies both the source revision and the version in each asset name. on: release: types: [published] permissions: contents: read jobs: build-release: runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - release_env: gh_release rc_env: gh_release_rc device: x3-x4 - release_env: sticky-gh_release rc_env: sticky-gh_release_rc device: sticky - release_env: x4pro-gh_release rc_env: x4pro-gh_release_rc device: x4pro - release_env: x4c-gh_release rc_env: x4c-gh_release_rc device: x4c - release_env: papermono-gh_release rc_env: papermono-gh_release_rc device: papermono steps: - uses: actions/checkout@v6 with: ref: ${{ github.event.release.tag_name }} submodules: recursive - name: Validate release version env: RELEASE_TAG: ${{ github.event.release.tag_name }} run: | version="${RELEASE_TAG#v}" configured_version="$(sed -n 's/^version = //p' platformio.ini | head -n1)" if [ "${{ github.event.release.prerelease }}" = "true" ]; then test "$version" = "${configured_version}rc" else test "$version" = "$configured_version" fi - uses: actions/setup-python@v6 with: python-version: '3.13' - name: Install uv uses: astral-sh/setup-uv@v7 with: version: "latest" enable-cache: false - name: Install PlatformIO Core run: | uv pip install --system -U https://github.com/pioarduino/platformio-core/archive/refs/tags/v6.1.19.zip # platform-espressif32's builder/main.py imports these unconditionally; its own # penv bootstrap (builder/penv_setup.py) is supposed to install them automatically # but isn't picking them up reliably in this runner image, so pin them explicitly. uv pip install --system -U "littlefs-python>=0.16.0" "fatfs-ng>=0.1.14" "pyyaml>=6.0.2" \ "rich-click>=1.8.6" "zopfli>=0.2.2" "intelhex>=2.3.0" "rich>=14.0.0" "urllib3<2" \ "cryptography>=45.0.3" "certifi>=2025.8.3" "ecdsa>=0.19.1" "bitstring>=4.3.1" \ "reedsolo>=1.5.3,<1.8" "esp-idf-size>=2.0.0" "esp-coredump>=1.14.0" - name: Pin pioarduino core inside the platform penv env: PIO_ENV: ${{ github.event.release.prerelease && matrix.rc_env || matrix.release_env }} run: | set -euo pipefail # Envs with custom_sdkconfig run a nested `pio run` from # ~/.platformio/penv. Keep that core on the same version as the outer core. # See https://github.com/pioarduino/platform-espressif32/issues/529 pio pkg install -e "$PIO_ENV" uv pip install --python ~/.platformio/penv/bin/python "pioarduino==6.1.19" ~/.platformio/penv/bin/pio --version - name: Build CrossPoint env: PIO_ENV: ${{ github.event.release.prerelease && matrix.rc_env || matrix.release_env }} run: CROSSPOINT_RC_HASH="$(git rev-parse --short=7 HEAD)" pio run -e "$PIO_ENV" -j1 - name: Prepare firmware asset id: asset env: PIO_ENV: ${{ github.event.release.prerelease && matrix.rc_env || matrix.release_env }} RELEASE_TAG: ${{ github.event.release.tag_name }} run: | version="${RELEASE_TAG#v}" asset="crosspoint-${version}-${{ matrix.device }}.bin" cp ".pio/build/${PIO_ENV}/firmware.bin" "$asset" echo "name=$asset" >> "$GITHUB_OUTPUT" - name: Stage firmware asset uses: actions/upload-artifact@v6 with: name: ${{ steps.asset.outputs.name }} path: ${{ steps.asset.outputs.name }} if-no-files-found: error retention-days: 1 compression-level: 0 publish-release: needs: build-release runs-on: ubuntu-latest permissions: contents: write steps: - name: Download firmware assets uses: actions/download-artifact@v4 with: path: dist pattern: crosspoint-*.bin merge-multiple: true - name: Attach firmware assets env: GH_TOKEN: ${{ github.token }} RELEASE_TAG: ${{ github.event.release.tag_name }} run: | version="${RELEASE_TAG#v}" for device in x3-x4 sticky x4pro x4c papermono; do test -f "dist/crosspoint-${version}-${device}.bin" done test "$(find dist -maxdepth 1 -type f -name 'crosspoint-*.bin' | wc -l)" -eq 5 gh release upload "$RELEASE_TAG" dist/crosspoint-*.bin \ --repo "$GITHUB_REPOSITORY" --clobber