mirror of
https://github.com/ByteWelder/Tactility.git
synced 2026-10-17 10:55:06 +00:00
174 lines
5.5 KiB
YAML
174 lines
5.5 KiB
YAML
name: Build Firmware
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- v*
|
|
pull_request:
|
|
types: [ opened, synchronize, reopened ]
|
|
|
|
permissions: read-all
|
|
|
|
jobs:
|
|
BuildSdkEsp32:
|
|
strategy:
|
|
matrix:
|
|
board: [
|
|
{ id: generic-esp32, arch: esp32 },
|
|
{ id: generic-esp32c6, arch: esp32c6 },
|
|
{ id: generic-esp32p4, arch: esp32p4 },
|
|
{ id: generic-esp32s3, arch: esp32s3 },
|
|
]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- name: "Build SDK"
|
|
uses: ./.github/actions/build-sdk
|
|
with:
|
|
board_id: ${{ matrix.board.id }}
|
|
arch: ${{ matrix.board.arch }}
|
|
BuildSdkPosix:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- name: "Build SDK"
|
|
uses: ./.github/actions/build-sdk-posix
|
|
BuildTools:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- name: "Build Tools"
|
|
uses: ./.github/actions/build-tools
|
|
# Always runs, so the jobs that depend on it aren't skipped for pushes
|
|
CheckTtVersion:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
if: github.event_name == 'pull_request'
|
|
with:
|
|
persist-credentials: false
|
|
fetch-depth: 0
|
|
- name: "Check tt version"
|
|
if: github.event_name == 'pull_request'
|
|
env:
|
|
BASE_REF: ${{ github.base_ref }}
|
|
run: python3 Buildscripts/check-tt-version.py "origin/$BASE_REF"
|
|
BuildTt:
|
|
runs-on: ubuntu-latest
|
|
needs: [ CheckTtVersion ]
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- name: "Build tt"
|
|
uses: ./.github/actions/build-tt
|
|
GenerateDeviceMatrix:
|
|
runs-on: ubuntu-latest
|
|
needs: [ BuildSdkEsp32 ]
|
|
outputs:
|
|
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- id: set-matrix
|
|
run: python3 Buildscripts/gh-generate-device-matrix.py
|
|
BuildFirmware:
|
|
runs-on: ubuntu-latest
|
|
needs: GenerateDeviceMatrix
|
|
strategy:
|
|
matrix: ${{ fromJSON(needs.GenerateDeviceMatrix.outputs.matrix) }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- name: "Build Firmware"
|
|
uses: ./.github/actions/build-firmware
|
|
with:
|
|
board_id: ${{ matrix.board.id }}
|
|
arch: ${{ matrix.board.arch }}
|
|
BundleArtifacts:
|
|
runs-on: ubuntu-latest
|
|
needs: [ BuildFirmware, BuildSdkPosix, BuildTools, BuildTt ]
|
|
if: |
|
|
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
|
|
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
persist-credentials: false
|
|
- name: "Bundle Artifacts"
|
|
uses: ./.github/actions/bundle-artifacts
|
|
PublishFirmwareSnapshot:
|
|
runs-on: ubuntu-latest
|
|
needs: [ BundleArtifacts ]
|
|
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: "Publish Firmware Snapshot"
|
|
env:
|
|
CDN_ID: ${{ secrets.CDN_ID }}
|
|
CDN_TOKEN_NAME: ${{ secrets.CDN_TOKEN_NAME }}
|
|
CDN_TOKEN_VALUE: ${{ secrets.CDN_TOKEN_VALUE }}
|
|
uses: ./.github/actions/publish-firmware
|
|
with:
|
|
cdn_version: snapshot
|
|
PublishFirmwareStable:
|
|
runs-on: ubuntu-latest
|
|
needs: [ BundleArtifacts ]
|
|
if: (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: "Publish Firmware Stable"
|
|
env:
|
|
CDN_ID: ${{ secrets.CDN_ID }}
|
|
CDN_TOKEN_NAME: ${{ secrets.CDN_TOKEN_NAME }}
|
|
CDN_TOKEN_VALUE: ${{ secrets.CDN_TOKEN_VALUE }}
|
|
uses: ./.github/actions/publish-firmware
|
|
with:
|
|
cdn_version: stable
|
|
PublishSdk:
|
|
runs-on: ubuntu-latest
|
|
needs: [ BundleArtifacts ]
|
|
if: (github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')))
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
# main only publishes -dev SDKs and tags only publish release SDKs, so merges after a release can't overwrite it
|
|
- name: "Check version"
|
|
id: version
|
|
shell: bash
|
|
run: |
|
|
version=$(cat version.txt)
|
|
if [[ "$GITHUB_REF" == refs/tags/v* && "$version" != *-dev ]] || [[ "$GITHUB_REF" == refs/heads/main && "$version" == *-dev ]]; then
|
|
echo "publish=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "publish=false" >> "$GITHUB_OUTPUT"
|
|
echo "::notice::Not publishing SDK $version from $GITHUB_REF"
|
|
fi
|
|
- name: "Publish SDKs"
|
|
if: steps.version.outputs.publish == 'true'
|
|
env:
|
|
CDN_ID: ${{ secrets.CDN_ID }}
|
|
CDN_TOKEN_NAME: ${{ secrets.CDN_TOKEN_NAME }}
|
|
CDN_TOKEN_VALUE: ${{ secrets.CDN_TOKEN_VALUE }}
|
|
uses: ./.github/actions/publish-sdk
|
|
PublishTt:
|
|
runs-on: ubuntu-latest
|
|
needs: [ BuildTt, BundleArtifacts ]
|
|
if: (github.event_name == 'push' && github.ref == 'refs/heads/main')
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- name: "Publish tt"
|
|
env:
|
|
CDN_ID: ${{ secrets.CDN_ID }}
|
|
CDN_TOKEN_NAME: ${{ secrets.CDN_TOKEN_NAME }}
|
|
CDN_TOKEN_VALUE: ${{ secrets.CDN_TOKEN_VALUE }}
|
|
uses: ./.github/actions/publish-tt
|