name: Build and Release the OpenIris bin files on: workflow_dispatch: push: tags: - "v*" branches: - "master" - "main" - "beta" - "feature/improv" pull_request: branches: - "master" - "main" - "beta" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true permissions: contents: write jobs: setup: runs-on: ubuntu-latest outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} steps: - id: set-matrix run: echo "matrix={\"target_name\":[\"esp32AIThinker\",\"esp32M5Stack\",\"esp32Cam\",\"esp_eye\",\"wrover\",\"wrooms3QIO\",\"wrooms3QIOUSB\",\"wrooms3\",\"wrooms3USB\",\"xiaosenses3\",\"xiaosenses3_USB\"],\"target_build_type\":[\"\", \"_release\"]}" >> $GITHUB_OUTPUT build: needs: setup strategy: fail-fast: false matrix: ${{fromJson(needs.setup.outputs.matrix)}} 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 "::endgroup::" 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@6 - 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: needs: [setup, release-openiris] strategy: fail-fast: false matrix: ${{fromJson(needs.setup.outputs.matrix)}} name: Cleanup actions 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