OpenIris/.github/workflows/build_release_bins.yml
2023-04-15 20:08:39 +01:00

118 lines
4.0 KiB
YAML

name: Build and Release the OpenIris bin files
on:
workflow_dispatch:
push:
tags:
- "v*"
branches:
- "master"
- "main"
- "feature/improv"
pull_request:
branches:
- "master"
- "main"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
target_name:
[esp32AIThinker, esp32M5Stack, esp32Cam, esp_eye, wrover, wrooms3QIO, wrooms3QIOUSB, wrooms3, wrooms3USB]
target_build_type: ["", _release] #, _OTA] # OTA is not needed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build OpenIris Firmware
uses: addnab/docker-run-action@v3
with:
image: ghcr.io/zanzythebar/piodocker:latest
options: -v ${{ github.workspace }}:/workspace
run: |
cd ESP
export OPENIRIS_CI_BUILD=1
mkdir build
mkdir build/${{ matrix.target_name }}${{ matrix.target_build_type }}
echo "::group::pio run"
pio run --environment ${{ matrix.target_name }}${{ matrix.target_build_type }}
echo "::endgroup::"
echo "::group::create zip"
unzip -l 'build/${{ matrix.target_name }}${{ matrix.target_build_type }}/*.zip'
echo "::endgroup::"
echo "::group::copy firmware name file"
cp tools/firmware_name.txt build/${{ matrix.target_name }}${{ matrix.target_build_type }}/firmware_name.txt
echo "::endgroup::"
- 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/build/${{ matrix.target_name }}${{ matrix.target_build_type }}/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: |
sudo apt-get install -y jq
chmod +x ./repo-tools/scripts/prepareCMD.sh
semantic-release
cleanup:
strategy:
fail-fast: false
matrix:
target_name:
[esp32AIThinker, esp32M5Stack, esp32Cam, esp_eye, wrover, wrooms3QIO, wrooms3QIOUSB, wrooms3, wrooms3USB]
target_build_type: ["", _release]
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