diff --git a/.github/workflows/universal-silabs-flasher.yml b/.github/workflows/universal-silabs-flasher.yml new file mode 100644 index 00000000..6011c0b9 --- /dev/null +++ b/.github/workflows/universal-silabs-flasher.yml @@ -0,0 +1,51 @@ +--- +name: Build Universal Silabs Flasher + +on: # yamllint disable-line rule:truthy + push: + branches: + - main + paths: + - .github/workflows/universal-silabs-flasher.yml + - images/universal-silabs-flasher/** + pull_request: + branches: + - main + paths: + - .github/workflows/universal-silabs-flasher.yml + - images/universal-silabs-flasher/** + +jobs: + build-container: + env: + EARTHLY_TOKEN: ${{ secrets.EARTHLY_TOKEN }} + EARTHLY_ORG: marinatedconcrete + EARTHLY_SATELLITE: config-repo + runs-on: "ubuntu-latest" + permissions: + contents: "read" + packages: "write" + + steps: + - uses: earthly/actions-setup@v1.0.8 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + # renovate: datasource=docker depName=earthly/earthly + version: "v0.7.22" + - uses: "actions/checkout@v4.1.1" + + - name: "Login to GitHub Container Hub" + run: docker login --username "${{ github.actor }}" --password "${{ secrets.GITHUB_TOKEN }}" ghcr.io + + - id: tags + run: echo "TAG=$BRANCH" | tr / _ >> "$GITHUB_ENV" + env: + BRANCH: ${{ github.event_name != 'pull_request' && 'latest' || format('pr-{0}', github.head_ref) }} + + - name: "Build Universal Silabs Flasher" + run: earthly ./images/universal-silabs-flasher/+image --TAG=$TAG + env: + EARTHLY_CI: true + EARTHLY_PUSH: true + # Only one platform per https://docs.earthly.dev/docs/earthly-command#build-options + EARTHLY_PLATFORMS: linux/amd64 diff --git a/images/Earthfile b/images/Earthfile index 6decc577..44fe2d72 100644 --- a/images/Earthfile +++ b/images/Earthfile @@ -4,4 +4,5 @@ FROM alpine all: BUILD ./kairos-ubuntu-22-lts/+image BUILD ./kairos-zsh-bundle/+image + BUILD ./universal-silabs-flasher/+image BUILD ./usb-image/+image diff --git a/images/universal-silabs-flasher/Earthfile b/images/universal-silabs-flasher/Earthfile new file mode 100644 index 00000000..e0a89ad7 --- /dev/null +++ b/images/universal-silabs-flasher/Earthfile @@ -0,0 +1,15 @@ +VERSION 0.7 +# renovate: datasource=docker depName=python +ARG PYTHON_VERSION=3.12.0-bullseye +FROM python:$PYTHON_VERSION + +image: + COPY requirements.txt . + RUN pip install -r requirements.txt + # Firmware appears to be unversioned in a way that renovate can handle + ARG FIRMWARE_BRANCH='main' + RUN git clone https://github.com/NabuCasa/silabs-firmware.git --branch $FIRMWARE_BRANCH + ARG TAG='latest' + SAVE IMAGE --push ghcr.io/marinatedconcrete/universal-silabs-flasher:$TAG + + diff --git a/images/universal-silabs-flasher/requirements.txt b/images/universal-silabs-flasher/requirements.txt new file mode 100644 index 00000000..f733ccda --- /dev/null +++ b/images/universal-silabs-flasher/requirements.txt @@ -0,0 +1,2 @@ +universal-silabs-flasher==0.0.15 +