Skip to content

Commit

Permalink
Feature/parallel architecture build (#65)
Browse files Browse the repository at this point in the history
Implement parallel architecture build

- Add a check to verify if the Omada version specified in config.yaml is available.
  - Abort the pipeline if unavailable.
  • Loading branch information
Jeruntu authored Dec 14, 2024
1 parent c58fca1 commit 13eea9e
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 13 deletions.
21 changes: 21 additions & 0 deletions .github/actions/version-checks/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Check Omada Version Availability
description: Check if the given Omada version is available
inputs:
version:
description: The version to check
required: true
runs:
using: "composite"
steps:
- name: Check Omada Version
shell: bash
run: |
URL="https://omada-controller-url.mbentley.net/hooks/omada_ver_to_url?omada-ver=${{ inputs.version }}"
OUTPUT=$(curl -sf "$URL")
if [ -z "$OUTPUT" ]; then
echo "Error: No output received from $URL"
exit 1
else
echo "Success: Received output"
echo "$OUTPUT"
fi
5 changes: 5 additions & 0 deletions .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "Docker Tag: $VERSION"
- name: Check Omada Version Availability
uses: ./.github/actions/version-checks
with:
version: "${{ env.VERSION }}"

- name: Build Docker Image
run: |
docker buildx build \
Expand Down
29 changes: 16 additions & 13 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ jobs:
echo "$1" | awk '{print toupper(substr($0,1,1)) tolower(substr($0,2))}'
}
CAPITALIZED_TARGET=$(capitalize "${{ matrix.target }}")
CONFIG_FILE="Omada ${CAPITALIZED_TARGET}/config.yaml"
VERSION=$(yq '.version' "${CONFIG_FILE}")
VERSION=$(yq '.version' "Omada ${CAPITALIZED_TARGET}/config.yaml")
DOCKER_IMAGE="${{ secrets.DOCKER_USER_NAME }}/home-assistant-omada"
echo "VERSION=$VERSION" >> $GITHUB_ENV
Expand All @@ -45,6 +44,11 @@ jobs:
echo "Version: $VERSION"
echo "Docker Image: $DOCKER_IMAGE"
- name: Check Omada Version Availability
uses: ./.github/actions/version-checks
with:
version: "${{ env.VERSION }}"

- name: Check if Image Exists
id: check_image
run: |
Expand All @@ -54,15 +58,14 @@ jobs:
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Build and Push Docker Image
- name: Build and push
if: steps.check_image.outputs.exists == 'false'
run: |
docker buildx build \
--platform linux/amd64,linux/arm64 \
--file "./Omada Dev/Dockerfile" \
--tag "${{ env.DOCKER_IMAGE }}-${{ matrix.target }}:${{ env.VERSION }}" \
--push \
--build-arg INSTALL_VER="${{ env.VERSION }}" \
--cache-from "type=registry,ref=${{ env.DOCKER_IMAGE }}-${{ matrix.target }}:cache" \
--cache-to "type=registry,ref=${{ env.DOCKER_IMAGE }}-${{ matrix.target }}:cache,mode=max" \
"./Omada Dev"
uses: docker/build-push-action@v6
with:
context: "Omada\ Dev"
build-args: INSTALL_VER=${{ env.VERSION }}
platforms: linux/amd64,linux/arm64
push: true
tags: "${{ env.DOCKER_IMAGE }}-${{ matrix.target }}:${{ env.VERSION }}"
cache-from: type=registry,ref=${{ env.DOCKER_IMAGE }}-${{ matrix.target }}:cache
cache-to: type=registry,ref=${{ env.DOCKER_IMAGE }}-${{ matrix.target }}:cache,mode=max

0 comments on commit 13eea9e

Please sign in to comment.