| 1 | name: Build and Deploy Web Flasher |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - main |
| 7 | |
| 8 | permissions: |
| 9 | contents: read |
| 10 | pages: write |
| 11 | id-token: write |
| 12 | |
| 13 | jobs: |
| 14 | build: |
| 15 | runs-on: ubuntu-latest |
| 16 | |
| 17 | steps: |
| 18 | - name: Checkout |
| 19 | uses: actions/checkout@v4 |
| 20 | |
| 21 | - name: Install PlatformIO |
| 22 | run: | |
| 23 | pip install platformio |
| 24 | |
| 25 | - name: Build Firmware |
| 26 | run: | |
| 27 | pio run |
| 28 | |
| 29 | - name: Copy Firmware Files |
| 30 | run: | |
| 31 | mkdir -p deploy |
| 32 | |
| 33 | cp web-flasher/index.html deploy/ |
| 34 | cp web-flasher/manifest.json deploy/ |
| 35 | |
| 36 | cp .pio/build/*/firmware.bin deploy/ |
| 37 | cp .pio/build/*/bootloader.bin deploy/ |
| 38 | cp .pio/build/*/partitions.bin deploy/ |
| 39 | |
| 40 | - name: Upload Pages Artifact |
| 41 | uses: actions/upload-pages-artifact@v3 |
| 42 | with: |
| 43 | path: deploy |
| 44 | |
| 45 | deploy: |
| 46 | needs: build |
| 47 | |
| 48 | runs-on: ubuntu-latest |
| 49 | |
| 50 | environment: |
| 51 | name: github-pages |
| 52 | url: ${{ steps.deployment.outputs.page_url }} |
| 53 | |
| 54 | steps: |
| 55 | - name: Deploy |
| 56 | id: deployment |
| 57 | uses: actions/deploy-pages@v4 |