|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v[0-9]+.[0-9]+.[0-9]+" |
| 7 | + - "v[0-9]+.[0-9]+.[0-9]+-*" |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + CARGO_TERM_COLOR: always |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: Build Firmware |
| 16 | + runs-on: ubuntu-latest |
| 17 | + permissions: |
| 18 | + contents: write |
| 19 | + steps: |
| 20 | + - name: Checkout repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Setup Rust (ESP32-S3) |
| 24 | + uses: esp-rs/xtensa-toolchain@v1.6 |
| 25 | + with: |
| 26 | + default: true |
| 27 | + version: "1.89.0" |
| 28 | + buildtargets: esp32s3 |
| 29 | + ldproxy: false |
| 30 | + |
| 31 | + - name: Install cargo-espflash |
| 32 | + run: | |
| 33 | + wget -q 'https://github.com/esp-rs/espflash/releases/download/v4.0.1/cargo-espflash-x86_64-unknown-linux-musl.zip' |
| 34 | + unzip -q cargo-espflash-x86_64-unknown-linux-musl.zip |
| 35 | + mv cargo-espflash ~/.cargo/bin/ |
| 36 | + chmod +x ~/.cargo/bin/cargo-espflash |
| 37 | +
|
| 38 | + - name: Enable caching |
| 39 | + uses: Swatinem/rust-cache@v2 |
| 40 | + |
| 41 | + - name: Build release binary |
| 42 | + run: | |
| 43 | + cargo espflash save-image --chip esp32s3 --release rfid-reader.bin |
| 44 | +
|
| 45 | + - name: Build merged binary (ready to flash) |
| 46 | + run: | |
| 47 | + cargo espflash save-image --merge --chip esp32s3 --flash-size 16mb --release rfid-reader-full.bin |
| 48 | +
|
| 49 | + - name: Upload artifacts |
| 50 | + uses: actions/upload-artifact@v4 |
| 51 | + with: |
| 52 | + name: firmware |
| 53 | + path: | |
| 54 | + rfid-reader.bin |
| 55 | + rfid-reader-full.bin |
| 56 | +
|
| 57 | + - name: Create Release |
| 58 | + if: startsWith(github.ref, 'refs/tags/') |
| 59 | + uses: softprops/action-gh-release@v1 |
| 60 | + with: |
| 61 | + files: | |
| 62 | + rfid-reader.bin |
| 63 | + rfid-reader-full.bin |
| 64 | + body: | |
| 65 | + ## ST25TB RFID Reader Firmware |
| 66 | + |
| 67 | + ### Files |
| 68 | + - `rfid-reader.bin` - Application binary only |
| 69 | + - `rfid-reader-full.bin` - Full merged binary (includes bootloader, ready to flash at 0x0) |
| 70 | + |
| 71 | + ### Flashing |
| 72 | + ```bash |
| 73 | + # Using espflash (recommended) |
| 74 | + espflash flash --port /dev/ttyUSB0 rfid-reader-full.bin |
| 75 | + |
| 76 | + # Or using esptool.py |
| 77 | + esptool.py --chip esp32s3 --port /dev/ttyUSB0 write_flash 0x0 rfid-reader-full.bin |
| 78 | + ``` |
| 79 | + draft: false |
| 80 | + prerelease: false |
| 81 | + env: |
| 82 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 83 | + |
| 84 | + ci: |
| 85 | + name: CI Check |
| 86 | + runs-on: ubuntu-latest |
| 87 | + if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/') |
| 88 | + steps: |
| 89 | + - name: Checkout repository |
| 90 | + uses: actions/checkout@v4 |
| 91 | + |
| 92 | + - name: Setup Rust (ESP32-S3) |
| 93 | + uses: esp-rs/xtensa-toolchain@v1.6 |
| 94 | + with: |
| 95 | + default: true |
| 96 | + version: "1.89.0" |
| 97 | + buildtargets: esp32s3 |
| 98 | + ldproxy: false |
| 99 | + |
| 100 | + - name: Enable caching |
| 101 | + uses: Swatinem/rust-cache@v2 |
| 102 | + |
| 103 | + - name: Check |
| 104 | + run: cargo check --release |
| 105 | + |
| 106 | + - name: Build |
| 107 | + run: cargo build --release |
0 commit comments