|
| 1 | +name: Manual Build (Select Environment) |
| 2 | +# All credits to Ninja-Jr @ninjajr |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + target_branch: |
| 7 | + description: 'Branch to build from' |
| 8 | + required: true |
| 9 | + default: 'main' |
| 10 | + type: string |
| 11 | + environment: |
| 12 | + description: 'Select environment to build' |
| 13 | + required: true |
| 14 | + default: 'lilygo-t-embed-cc1101' |
| 15 | + type: choice |
| 16 | + options: |
| 17 | + - "m5stack-cardputer" |
| 18 | + - "m5stack-cplus2" |
| 19 | + - "m5stack-cplus1_1" |
| 20 | + - "LAUNCHER_m5stack-cplus1_1" |
| 21 | + - "m5stack-core2" |
| 22 | + - "m5stack-core16mb" |
| 23 | + - "m5stack-core4mb" |
| 24 | + - "m5stack-cores3" |
| 25 | + - "esp32-s3-devkitc-1" |
| 26 | + - "esp32-c5" |
| 27 | + - "esp32-c5-tft" |
| 28 | + - "CYD-2432S028" |
| 29 | + - "CYD-2USB" |
| 30 | + - "CYD-2432W328C" |
| 31 | + - "CYD-2432W328C_2" |
| 32 | + - "CYD-2432W328R-or-S024R" |
| 33 | + - "CYD-3248S035R" |
| 34 | + - "CYD-3248S035C" |
| 35 | + - "LAUNCHER_CYD-2432W328R-or-S024R" |
| 36 | + - "LAUNCHER_CYD-2432S028" |
| 37 | + - "LAUNCHER_CYD-2USB" |
| 38 | + - "LAUNCHER_CYD-2432W328C" |
| 39 | + - "LAUNCHER_CYD-3248S035R" |
| 40 | + - "LAUNCHER_CYD-3248S035C" |
| 41 | + - "lilygo-t-embed-cc1101" |
| 42 | + - "lilygo-t-embed" |
| 43 | + - "lilygo-t-deck" |
| 44 | + - "lilygo-t-watch-s3" |
| 45 | + - "lilygo-t-deck-pro" |
| 46 | + - "lilygo-t-display-s3" |
| 47 | + - "lilygo-t-display-s3-touch" |
| 48 | + - "lilygo-t-display-s3-mmc" |
| 49 | + - "lilygo-t-display-s3-touch-mmc" |
| 50 | + - "lilygo-t-display-s3-pro" |
| 51 | + - "lilygo-t-display-ttgo" |
| 52 | + - "lilygo-t-hmi" |
| 53 | + - "lilygo-t-lora-pager" |
| 54 | + - "smoochiee-board" |
| 55 | + - "Phantom_S024R" |
| 56 | + - "LAUNCHER_Phantom_S024R" |
| 57 | + - "Marauder-Mini" |
| 58 | + - "LAUNCHER_Marauder-Mini" |
| 59 | + - "Awok-Mini" |
| 60 | + - "Marauder-v7" |
| 61 | + - "LAUNCHER_Marauder-v7" |
| 62 | + - "Marauder-V4-V6" |
| 63 | + - "Marauder-v61" |
| 64 | + - "LAUNCHER_Marauder-V4-V6" |
| 65 | + - "LAUNCHER_Marauder-v61" |
| 66 | + - "Awok-Touch" |
| 67 | + - "WaveSentry-R1" |
| 68 | + - "LAUNCHER_WaveSentry-R1" |
| 69 | + |
| 70 | +jobs: |
| 71 | + compile_selected: |
| 72 | + name: Build ${{ github.event.inputs.environment }} |
| 73 | + runs-on: ubuntu-latest |
| 74 | + env: |
| 75 | + SELECTED_ENV: ${{ github.event.inputs.environment }} |
| 76 | + |
| 77 | + steps: |
| 78 | + - name: Checkout repository |
| 79 | + uses: actions/checkout@v4 |
| 80 | + with: |
| 81 | + ref: ${{ github.event.inputs.target_branch }} |
| 82 | + |
| 83 | + - name: Setup Python |
| 84 | + uses: actions/setup-python@v5 |
| 85 | + with: |
| 86 | + python-version: "3.13" |
| 87 | + |
| 88 | + - name: Cache pip |
| 89 | + uses: actions/cache@v4 |
| 90 | + with: |
| 91 | + path: ~/.cache/pip |
| 92 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }} |
| 93 | + restore-keys: | |
| 94 | + ${{ runner.os }}-pip-${{ hashFiles('**/requirements*.txt') }} |
| 95 | + ${{ runner.os }}-pip- |
| 96 | +
|
| 97 | + - name: Cache PlatformIO Framework |
| 98 | + uses: actions/cache@v4 |
| 99 | + with: |
| 100 | + path: ~/.platformio |
| 101 | + key: ${{ runner.os }}-platformio-${{ hashFiles('platformio.ini') }} |
| 102 | + restore-keys: | |
| 103 | + ${{ runner.os }}-platformio-${{ hashFiles('platformio.ini') }} |
| 104 | + ${{ runner.os }}-platformio- |
| 105 | +
|
| 106 | + - name: PIO libraries cache |
| 107 | + uses: actions/cache@v4 |
| 108 | + with: |
| 109 | + path: .pio/libdeps |
| 110 | + key: ${{ runner.os }}-pio-${{ env.SELECTED_ENV }}-${{ hashFiles('platformio.ini') }} |
| 111 | + restore-keys: | |
| 112 | + ${{ runner.os }}-pio-${{ env.SELECTED_ENV }}-${{ hashFiles('platformio.ini') }} |
| 113 | + ${{ runner.os }}-pio-${{ env.SELECTED_ENV }}- |
| 114 | +
|
| 115 | + - name: Install dependencies |
| 116 | + run: | |
| 117 | + pip install requests esptool intelhex |
| 118 | + pip install platformio |
| 119 | +
|
| 120 | + - name: Prepare PlatformIO file (Bruce version logic) |
| 121 | + id: prepare_version |
| 122 | + run: | |
| 123 | + echo "Preparing PlatformIO configuration..." |
| 124 | +
|
| 125 | + # Manual builds always use commit SHA (simple and logical) |
| 126 | + version="${GITHUB_SHA::7}" |
| 127 | + echo "Using commit SHA: $version" |
| 128 | +
|
| 129 | + echo "VERSION=$version" >> $GITHUB_OUTPUT |
| 130 | +
|
| 131 | + # Apply version to platformio.ini (upstream method) |
| 132 | + sed -i "s/-DBRUCE_VERSION=/-DBRUCE_VERSION='\"$version\"' ; /g" ./platformio.ini |
| 133 | + sed -i "s/-DGIT_COMMIT_HASH='\"Homebrew\"'/!echo '-DGIT_COMMIT_HASH=\\\\\"'\$(git describe --always --dirty)'\\\\\"'/g" ./platformio.ini |
| 134 | +
|
| 135 | + - name: Run Compile |
| 136 | + run: | |
| 137 | + set -o pipefail |
| 138 | + echo "Building environment: ${{ env.SELECTED_ENV }}" |
| 139 | + platformio run -e "${{ env.SELECTED_ENV }}" | tee "build-${{ env.SELECTED_ENV }}.log" |
| 140 | +
|
| 141 | + - name: Build summary |
| 142 | + run: | |
| 143 | + if [[ -f "build-${{ env.SELECTED_ENV }}.log" ]]; then |
| 144 | + echo "Last 75 lines of build-${{ env.SELECTED_ENV }}.log:" |
| 145 | + tail -n 75 "build-${{ env.SELECTED_ENV }}.log" |
| 146 | + else |
| 147 | + echo "Build log not found; nothing to show." |
| 148 | + fi |
| 149 | +
|
| 150 | + - name: Upload Artifacts |
| 151 | + uses: actions/upload-artifact@v4 |
| 152 | + with: |
| 153 | + name: Bruce-${{ env.SELECTED_ENV }} |
| 154 | + path: Bruce-*.* |
| 155 | + retention-days: 1 |
| 156 | + if-no-files-found: error |
| 157 | + |
| 158 | + - name: Display Build Info |
| 159 | + run: | |
| 160 | + echo "Build completed successfully!" |
| 161 | + echo "Environment: ${{ env.SELECTED_ENV }}" |
| 162 | + echo "Version: ${{ steps.prepare_version.outputs.VERSION }}" |
| 163 | + echo "Git Hash: $(git describe --always --dirty)" |
| 164 | + echo "Built files:" |
| 165 | + ls -la Bruce-*.* 2>/dev/null || echo "No Bruce files found" |
0 commit comments