diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.yml new file mode 100644 index 0000000..8e48195 --- /dev/null +++ b/.github/workflows/deploy-pages.yml @@ -0,0 +1,170 @@ +name: Publish Firmware + +on: + workflow_run: + workflows: + - "Application CI" # Must match the name in build_firmware.yml + types: + - completed +jobs: + get-version: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Get firmware version + id: get_fw_version + run: | + version=$(git describe --abbrev=4 --dirty --always --tags)-[$(git rev-parse --abbrev-ref HEAD)] + echo "fw_version=$version" >> $GITHUB_OUTPUT + + publish: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + + steps: + - name: Checkout gh-pages branch + uses: actions/checkout@v2 + with: + ref: gh-pages + + - name: Create directories + run: | + mkdir -p download/esp8266/testing/debug + mkdir -p download/esp8266/testing/release + mkdir -p download/esp32/testing/debug + mkdir -p download/esp32/testing/release + mkdir -p download/esp32c3/testing/debug + mkdir -p download/esp32c3/testing/release + + # Download each artifact from the build_firmware workflow and move it to the correct path + - name: Download esp8266 debug + uses: actions/download-artifact@v3 + with: + name: lightinator-esp8266-debug + path: download/esp8266/testing/debug + + - name: Download esp8266 release + uses: actions/download-artifact@v3 + with: + name: lightinator-esp8266-release + path: download/esp8266/testing/release + + - name: Download esp32 debug + uses: actions/download-artifact@v3 + with: + name: lightinator-esp32-debug + path: download/esp32/testing/debug + + - name: Download esp32 release + uses: actions/download-artifact@v3 + with: + name: lightinator-esp32-release + path: download/esp32/testing/release + + - name: Download esp32c3 debug + uses: actions/download-artifact@v3 + with: + name: lightinator-esp32c3-debug + path: download/esp32c3/testing/debug + + - name: Download esp32c3 release + uses: actions/download-artifact@v3 + with: + name: lightinator-esp32c3-release + path: download/esp32c3/testing/release + + - name: Generate firmware.json + run: | + cat < firmware.json + { + "firmware": [ + { + "soc": "esp8266", + "type": "debug", + "branch": "testing", + "fw_version": "${{ steps.get_fw_version.outputs.fw_version }}", + "files": { + "rom": { + "url": "download/esp8266/testing/debug/rom0.bin" + } + } + }, + { + "soc": "esp8266", + "type": "release", + "branch": "testing", + "fw_version": "${{ steps.get_fw_version.outputs.fw_version }}", + "files": { + "rom": { + "url": "download/esp8266/testing/release/rom0.bin" + } + } + }, + { + "soc": "esp32", + "type": "debug", + "branch": "testing", + "fw_version": "${{ steps.get_fw_version.outputs.fw_version }}", + "files": { + "rom": { + "url": "download/esp32/testing/debug/app.bin" + } + } + }, + { + "soc": "esp32", + "type": "release", + "branch": "testing", + "fw_version": "${{ steps.get_fw_version.outputs.fw_version }}", + "files": { + "rom": { + "url": "download/esp32/testing/release" + } + } + }, + { + "soc": "esp32c3", + "type": "debug", + "branch": "testing", + "fw_version": "${{ steps.get_fw_version.outputs.fw_version }}", + "files": { + "rom": { + "url": "download/esp32c3/testing/debug" + } + } + }, + { + "soc": "esp32c3", + "type": "release", + "branch": "testing", + "fw_version": "${{ steps.get_fw_version.outputs.fw_version }}", + "files": { + "rom": { + "url": "download/esp32c3/testing/release" + } + } + } + ], + "rom": { + "fw_version": "${{ steps.get_fw_version.outputs.fw_version }}", + "url": "download/esp8266/testing/release/rom0.bin" + }, + "spiffs": { + "webapp_version": "0.3.3", + "url": "http://rgbww.dronezone.de/testing/spiff_rom.bin" + } + } + EOF + + # Commit and push to gh-pages + - name: Commit and push changes + run: | + git config user.name "GitHub Actions" + git config user.email "actions@github.com" + git add . + git commit -m "Publish firmware artifacts and JSON" || echo "No changes to commit" + git push origin gh-pages \ No newline at end of file