|
| 1 | +# Build the Ropener firmware for every board and, on a tag, attach the factory |
| 2 | +# + OTA binaries (and the .ota.bin.md5 the on-device "Update Firmware" button |
| 3 | +# needs) to the GitHub release. Field units self-update by asset name, so keep |
| 4 | +# the Ropener-VAL3000 / Ropener-VAL3100 names stable. |
| 5 | +name: Build firmware |
| 6 | + |
| 7 | +on: |
| 8 | + push: |
| 9 | + branches: [main, 'rewire/valar-core'] # rewire/* verifies the branch pre-merge; remove after merge |
| 10 | + tags: ['v*'] |
| 11 | + pull_request: |
| 12 | + workflow_dispatch: |
| 13 | + |
| 14 | +jobs: |
| 15 | + build: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + strategy: |
| 18 | + fail-fast: false |
| 19 | + matrix: |
| 20 | + include: |
| 21 | + - config: firmware/VAL3000/Ropener-VAL3000.yml |
| 22 | + asset: Ropener-VAL3000 |
| 23 | + - config: firmware/VAL3100/Ropener-VAL3100.yml |
| 24 | + asset: Ropener-VAL3100 |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + - uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version: '3.11' |
| 30 | + - name: Install ESPHome |
| 31 | + run: pip install esphome |
| 32 | + |
| 33 | + # On a tag build, stamp the release version (strip a leading "v") so the |
| 34 | + # on-device "Firmware Version" matches the release the unit is running. |
| 35 | + - name: Compile ${{ matrix.asset }} |
| 36 | + run: | |
| 37 | + if [ "${{ github.ref_type }}" = "tag" ]; then |
| 38 | + V="${{ github.ref_name }}"; V="${V#v}" |
| 39 | + esphome -s fw_version "$V" compile "${{ matrix.config }}" |
| 40 | + else |
| 41 | + esphome compile "${{ matrix.config }}" |
| 42 | + fi |
| 43 | +
|
| 44 | + - name: Collect binaries + md5 |
| 45 | + run: | |
| 46 | + mkdir -p dist |
| 47 | + F=$(find . -path "*/.pioenvs/*/firmware.factory.bin" | head -1) |
| 48 | + O=$(find . -path "*/.pioenvs/*/firmware.ota.bin" | head -1) |
| 49 | + cp "$F" "dist/${{ matrix.asset }}.factory.bin" |
| 50 | + cp "$O" "dist/${{ matrix.asset }}.ota.bin" |
| 51 | + md5sum "dist/${{ matrix.asset }}.ota.bin" | cut -d' ' -f1 > "dist/${{ matrix.asset }}.ota.bin.md5" |
| 52 | +
|
| 53 | + - uses: actions/upload-artifact@v4 |
| 54 | + with: |
| 55 | + name: ${{ matrix.asset }} |
| 56 | + path: dist/* |
| 57 | + |
| 58 | + - name: Attach to release |
| 59 | + if: startsWith(github.ref, 'refs/tags/') |
| 60 | + uses: softprops/action-gh-release@v2 |
| 61 | + with: |
| 62 | + files: dist/* |
0 commit comments