OpenIris/.github/workflows/build_release_bins.yml
2023-02-27 14:37:39 +00:00

123 lines
4.1 KiB
YAML

name: Build and Release the OpenIris bin files
on:
push:
branches:
- "master"
- "main"
pull_request:
branches:
- "master"
- "main"
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
target_name: [esp32AIThinker, esp32M5Stack, esp32Cam, esp_eye, wrover]
target_build_type: ["", _release, _OTA]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
restore-keys: |
${{ runner.os }}-pio-
- name: Setup Python install
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install PlatformIO with Pip
run: |
python -m pip install --upgrade pip
pip install distro
pip install --upgrade platformio
pio upgrade --dev
pio pkg update --global
- name: Update build command
working-directory: ./ESP
run: |
sed -i '/\[env\]/p; s/\[env\]/upload_protocol = custom/' platformio.ini
- name: Build OpenIris Firmware
working-directory: ./ESP
run: |
export OPENIRIS_CI_BUILD=1
mkdir build
mkdir build/${{ matrix.target_name }}${{ matrix.target_build_type }}
echo "::group::platformio.ini"
cat platformio.ini
echo "::endgroup::"
echo "::group::pio run"
pio run --environment ${{ matrix.target_name }}${{ matrix.target_build_type }}
echo "::endgroup::"
unzip -l './build/${{ matrix.target_name }}${{ matrix.target_build_type }}/*.zip'
- name: Archive Firmware name File
# create an environment variable with the name of the firmware file by catting the firmware_name.txt file
run: |
echo "FIRMWARE_NAME=$(cat ./ESP/tools/firmware_name.txt)" >> $GITHUB_ENV
- name: Archive Firmware Binaries
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target_name }}${{ matrix.target_build_type }}-firmware
#path: "./ESP/.pio/build/${{ matrix.target_name }}${{ matrix.target_build_type }}/${{ env.FIRMWARE_NAME }}.bin"
path: "./ESP/build/${{ matrix.target_name }}${{ matrix.target_build_type }}/${{ env.FIRMWARE_NAME }}.zip"
retention-days: 5
if-no-files-found: error
release-openiris:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Create Directory
run: mkdir -p build
- name: Download Firmware Files
uses: actions/download-artifact@v2
with:
path: build/
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install -g conventional-changelog-conventionalcommits
- run: npm install -g semantic-release@v19.0.5
- run: npm install -g @semantic-release/exec
- run: npm install -g @semantic-release/git
- run: npm install -g @semantic-release/release-notes-generator
- run: npm install -g @semantic-release/changelog
- run: npm install -g @semantic-release/github
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: semantic-release
cleanup:
strategy:
fail-fast: false
matrix:
target_name: [esp32AIThinker, esp32M5Stack, esp32Cam, esp_eye, wrover]
target_build_type: ["", _release, _OTA]
name: Cleanup actions
needs:
- release-openiris
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "♻️ remove build artifacts"
uses: geekyeggo/delete-artifact@v1
with:
name: ${{ matrix.target_name }}${{ matrix.target_build_type }}-firmware