| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- name: Build and Pack
- on: [push]
- jobs:
- build:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- with:
- submodules: recursive
-
- - name: Cache PlatformIO
- uses: actions/cache@v2
- with:
- path: ~/.platformio
- key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- - name: Set up Python
- uses: actions/setup-python@v2
- - name: Install PlatformIO
- run: |
- python -m pip install --upgrade pip
- pip install --upgrade platformio
- - name: Set Variables
- id: vars
- run: |
- echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- echo "::set-output name=date_time::$(git log -1 --format="%at" | xargs -I{} date -d @{} '+%Y-%m-%d %H:%M:%S')"
- echo "::set-output name=date_time_filename::$(git log -1 --format="%at" | xargs -I{} date -d @{} '+%Y-%m-%d_%H-%M-%S')"
- #echo "::set-output name=version_string::${{ steps.vars.outputs.date_time_filename }}__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
- #echo "Version String: ${{ steps.vars.outputs.version_string }}"
- - name: Set Version used in HTML Info page
- run: echo "${{ steps.vars.outputs.date_time }}, ${{ github.ref_name }} (${{ steps.vars.outputs.sha_short }})" > "sd-card/html/version.txt"
- - name: Build Firmware
- #run: mkdir -p ./code/.pio/build/esp32cam/; touch ./code/.pio/build/esp32cam/firmware.bin; touch ./code/.pio/build/esp32cam/bootloader.bin; touch ./code/.pio/build/esp32cam/partitions.bin # Testing
- run: cd code; platformio run --environment esp32cam
-
- # Old OTA concept
- # firmware__*.zip needs to be unpacked before attaching to the release!
- # The bin filename can contain versioning.
- - name: Rename firmware file to contain versioning (old ota)
- run: |
- mkdir -p ./dist_old_ota
- 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"
- ls -l ./dist_old_ota
- - name: Upload Firmware artifact (old OTA concept)
- uses: actions/upload-artifact@v3
- with:
- name: "firmware__extract_before_upload__only_needed_for_migration_from_11.2.0"
- path: ./dist_old_ota/*
- - name: Upload Web interface artifact (old OTA concept)
- uses: actions/upload-artifact@v3
- with:
- name: "html__only_needed_for_migration_from_11.2.0__${{ steps.vars.outputs.date_time_filename }}__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
- path: ./sd-card/html/*
- # New OTA concept
- # update__version.zip file with following content:
- # - /firmware.bin
- # - (optional) /html/*
- # - (optional) /config/*.tfl
- - name: Prepare update.zip artifact
- run: |
- mkdir -p ./dist
- cp "./code/.pio/build/esp32cam/firmware.bin" "dist/firmware.bin"
- - name: Upload update.zip Artifact (Firmware only)
- uses: actions/upload-artifact@v3
- with:
- name: "update_firmware_only__${{ steps.vars.outputs.date_time_filename }}__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
- path: ./dist/*
-
- - name: Prepare update.zip artifact (Firmware + Web UI)
- run: cp -r ./sd-card/html ./dist/
- - name: Upload update.zip artifact (Firmware + Web UI)
- uses: actions/upload-artifact@v3
- with:
- name: "update_firmware+web_ui__${{ steps.vars.outputs.date_time_filename }}__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
- path: ./dist/*
-
- - name: Prepare update.zip artifact (Firmware + Web UI + CNN)
- run: |
- mkdir ./dist/config/
- cp ./sd-card/config/*.tfl ./dist/config/ 2>/dev/null || true
- cp ./sd-card/config/*.tflite ./dist/config/ 2>/dev/null || true
- - name: Upload update.zip artifact (Firmware + Web UI + CNN)
- uses: actions/upload-artifact@v3
- with:
- name: "update_firmware+web_ui+cnn__${{ steps.vars.outputs.date_time_filename }}__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
- path: ./dist/*
- # creates old style binaries for fresh installation (backward compatible to wiki)
- - name: Copy artifacts to firmware folder
- run: |
- mkdir -p firmware
- # copy builds to firmware folder for committing in next step
- cp -f "./code/.pio/build/esp32cam/firmware.bin" "firmware/firmware.bin"
- cp -f "./code/.pio/build/esp32cam/bootloader.bin" "firmware/bootloader.bin"
- cp -f "./code/.pio/build/esp32cam/partitions.bin" "firmware/partitions.bin"
- cd sd-card
- rm -f ../firmware/html.zip
- zip -r ../firmware/html.zip html
- cd ../dist
- zip -r ../firmware/update.zip .
-
- # extract the version used in next step
- - id: get_version
- if: startsWith(github.ref, 'refs/tags/')
- uses: battila7/get-version-action@v2
- # the changelog [unreleased] will now be changed to the release version
- - name: Update changelog
- uses: thomaseizinger/keep-a-changelog-new-release@v1
- if: startsWith(github.ref, 'refs/tags/')
- with:
- changelogPath: Changelog.md
- version: ${{ steps.get_version.outputs.version-without-v }}
-
- # the release notes will be extracted from changelog
- - name: Extract release notes
- id: extract-release-notes
- if: startsWith(github.ref, 'refs/tags/')
- uses: ffurrer2/extract-release-notes@v1
- with:
- changelog_file: Changelog.md
-
- # Releases should only be created on master by tagging the last commit.
- # all artifacts in firmware folder pushed to the release
- - name: Release
- uses: softprops/action-gh-release@v1
- if: startsWith(github.ref, 'refs/tags/')
- with:
- name: ${{ steps.get_version.outputs.version-without-v }}
- body: ${{ steps.extract-release-notes.outputs.release_notes }}
- files: |
- firmware/*
-
- # Commit&Push Changelog to master branch. Must be manually merged back to rolling
- - name: Commit changes and push changes
- if: startsWith(github.ref, 'refs/tags/')
- run: |
- git config user.name github-actions
- git config user.email github-actions@github.com
- git add Changelog.md
- git commit Changelog.md -m "Update Changelog.md for ${{github.event.inputs.versionIncrement}} release"
- git push origin HEAD:master
|