mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-25 08:58:15 +03:00
107 lines
3.9 KiB
YAML
107 lines
3.9 KiB
YAML
name: Build and Pack
|
|
|
|
on: [push]
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- 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 # 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/*
|