build.yaml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. name: Build and Pack
  2. on: [push]
  3. jobs:
  4. build:
  5. runs-on: ubuntu-latest
  6. steps:
  7. - uses: actions/checkout@v2
  8. - name: Cache PlatformIO
  9. uses: actions/cache@v2
  10. with:
  11. path: ~/.platformio
  12. key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
  13. - name: Set up Python
  14. uses: actions/setup-python@v2
  15. - name: Install PlatformIO
  16. run: |
  17. python -m pip install --upgrade pip
  18. pip install --upgrade platformio
  19. - name: Set Variables
  20. id: vars
  21. run: |
  22. echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
  23. echo "::set-output name=date_time::$(git log -1 --format="%at" | xargs -I{} date -d @{} '+%Y-%m-%d %H:%M:%S')"
  24. echo "::set-output name=date_time_filename::$(git log -1 --format="%at" | xargs -I{} date -d @{} '+%Y-%m-%d_%H-%M-%S')"
  25. #echo "::set-output name=version_string::${{ steps.vars.outputs.date_time_filename }}__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
  26. #echo "Version String: ${{ steps.vars.outputs.version_string }}"
  27. - name: Set Version used in HTML Info page
  28. run: echo "${{ steps.vars.outputs.date_time }}, ${{ github.ref_name }} (${{ steps.vars.outputs.sha_short }})" > "sd-card/html/version.txt"
  29. - name: Build Firmware
  30. # run: mkdir -p ./code/.pio/build/esp32cam/; touch ./code/.pio/build/esp32cam/firmware.bin # Testing
  31. run: cd code; platformio run --environment esp32cam
  32. # Old OTA concept
  33. # firmware__*.zip needs to be unpacked before attaching to the release!
  34. # The bin filename can contain versioning.
  35. - name: Rename firmware file to contain versioning (old ota)
  36. run: |
  37. mkdir -p ./dist_old_ota
  38. cp "./code/.pio/build/esp32cam/firmware.bin" "./dist_old_ota/firmware__${{ steps.vars.outputs.date_time_filename }}__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }}).bin"
  39. ls -l ./dist_old_ota
  40. - name: Upload Firmware artifact (old OTA concept)
  41. uses: actions/upload-artifact@v3
  42. with:
  43. name: "firmware__extract_before_upload__only_needed_for_migration_from_11.2.0"
  44. path: ./dist_old_ota/*
  45. - name: Upload Web interface artifact (old OTA concept)
  46. uses: actions/upload-artifact@v3
  47. with:
  48. name: "html__only_needed_for_migration_from_11.2.0__${{ steps.vars.outputs.date_time_filename }}__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
  49. path: ./sd-card/html/*
  50. # New OTA concept
  51. # update__version.zip file with following content:
  52. # - /firmware.bin
  53. # - (optional) /html/*
  54. # - (optional) /config/*.tfl
  55. - name: Prepare update.zip artifact
  56. run: |
  57. mkdir -p ./dist
  58. cp "./code/.pio/build/esp32cam/firmware.bin" "dist/firmware.bin"
  59. - name: Upload update.zip Artifact (Firmware only)
  60. uses: actions/upload-artifact@v3
  61. with:
  62. name: "update_firmware_only__${{ steps.vars.outputs.date_time_filename }}__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
  63. path: ./dist/*
  64. - name: Prepare update.zip artifact (Firmware + Web UI)
  65. run: cp -r ./sd-card/html ./dist/
  66. - name: Upload update.zip artifact (Firmware + Web UI)
  67. uses: actions/upload-artifact@v3
  68. with:
  69. name: "update_firmware+web_ui__${{ steps.vars.outputs.date_time_filename }}__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
  70. path: ./dist/*
  71. - name: Prepare update.zip artifact (Firmware + Web UI + CNN)
  72. run: |
  73. mkdir ./dist/config/
  74. cp ./sd-card/config/*.tfl ./dist/config/ 2>/dev/null || true
  75. cp ./sd-card/config/*.tflite ./dist/config/ 2>/dev/null || true
  76. - name: Upload update.zip artifact (Firmware + Web UI + CNN)
  77. uses: actions/upload-artifact@v3
  78. with:
  79. name: "update_firmware+web_ui+cnn__${{ steps.vars.outputs.date_time_filename }}__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
  80. path: ./dist/*