Skip to content

Commit

Permalink
Merge pull request #56 from Jeruntu/jjo/implement_mbentley_as_submodu…
Browse files Browse the repository at this point in the history
…le_and_share_common_code

Implement mbentley as submodule and share common code
  • Loading branch information
Jeruntu authored Nov 16, 2024
2 parents 357c82b + e158033 commit 9125711
Show file tree
Hide file tree
Showing 32 changed files with 289 additions and 1,287 deletions.
91 changes: 59 additions & 32 deletions .github/workflows/docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,74 +5,101 @@ on:
tags:
- 'v*-stable'
- 'v*-beta'
branches:
- '**'

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout the code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: dratrav
username: ${{ secrets.DOCKER_USER_NAME }}
password: ${{ secrets.DOCKER_ACCESS_TOKEN }}

- name: Extract Docker tag from Git tag
- name: Extract Docker tag or branch
id: version
run: |
# Extract the Git tag name
GIT_TAG="${GITHUB_REF_NAME}"
# Remove 'v' prefix and '-stable' or '-beta' suffix
DOCKER_TAG="${GIT_TAG#v}" # Remove leading 'v'
DOCKER_TAG="${DOCKER_TAG%-*}" # Remove trailing '-stable' or '-beta'
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
DOCKER_TAG="${GITHUB_REF_NAME#v}"
DOCKER_TAG="${DOCKER_TAG%-*}"
else
DOCKER_TAG="latest"
fi
if [[ -z "$DOCKER_TAG" ]]; then
echo "Error: DOCKER_TAG is empty!" >&2
exit 1
fi
echo "DOCKER_TAG=$DOCKER_TAG" >> $GITHUB_ENV
- name: Set image name and config file based on tag type
- name: Set image name and config file
id: image_name
run: |
if [[ "${GITHUB_REF_NAME}" == *-beta ]]; then
echo "IMAGE_NAME=dratrav/home-assistant-omada-beta" >> $GITHUB_ENV
echo "IMAGE_NAME=${{ secrets.DOCKER_USER_NAME }}/home-assistant-omada-beta" >> $GITHUB_ENV
echo "CONFIG_FILE=Omada Beta/config.yaml" >> $GITHUB_ENV
echo "DOCKERFILE_PATH=./Omada Beta/Dockerfile" >> $GITHUB_ENV
echo "CONTEXT_PATH=./Omada Beta" >> $GITHUB_ENV
elif [[ "${GITHUB_REF_NAME}" == *-stable ]]; then
echo "IMAGE_NAME=dratrav/home-assistant-omada-stable" >> $GITHUB_ENV
echo "IMAGE_NAME=${{ secrets.DOCKER_USER_NAME }}/home-assistant-omada-stable" >> $GITHUB_ENV
echo "CONFIG_FILE=Omada Stable/config.yaml" >> $GITHUB_ENV
echo "DOCKERFILE_PATH=./Omada Stable/Dockerfile" >> $GITHUB_ENV
echo "CONTEXT_PATH=./Omada Stable" >> $GITHUB_ENV
else
echo "IMAGE_NAME=${{ secrets.DOCKER_USER_NAME }}/home-assistant-omada-dev" >> $GITHUB_ENV
echo "CONFIG_FILE=Omada Dev/config.yaml" >> $GITHUB_ENV
fi
- name: Install yq
- name: Set INSTALL_VER from config.yaml
run: |
EXPECTED_TAG=$(yq '.version' "${CONFIG_FILE}")
echo "INSTALL_VER=$EXPECTED_TAG" >> $GITHUB_ENV
- name: Log key variables
run: |
wget https://github.com/mikefarah/yq/releases/download/v4.27.3/yq_linux_amd64 -O /usr/local/bin/yq
chmod +x /usr/local/bin/yq
echo "Docker Image Name: ${{ env.IMAGE_NAME }}"
echo "Docker Tag: ${{ env.DOCKER_TAG }}"
echo "Install Version: ${{ env.INSTALL_VER }}"
- name: Verify Docker tag matches config.yaml
if: startsWith(github.ref, 'refs/tags/')
run: |
# Extract the expected tag from the config.yaml file
EXPECTED_TAG=$(yq '.version' "${CONFIG_FILE}")
# Check if the expected tag matches the extracted Docker tag
if [[ "${EXPECTED_TAG}" != "${DOCKER_TAG}" ]]; then
echo "Error: Docker tag (${DOCKER_TAG}) does not match expected tag (${EXPECTED_TAG}) in ${CONFIG_FILE}."
if [[ "${INSTALL_VER}" != "${DOCKER_TAG}" ]]; then
echo "Error: Docker tag (${DOCKER_TAG}) does not match expected tag (${INSTALL_VER}) in ${CONFIG_FILE}."
exit 1
fi
- name: Build and push Docker image
if: success()
uses: docker/build-push-action@v5
- name: Build Docker image for test builds
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
docker buildx build \
--platform linux/amd64 \
--file "./Omada Dev/Dockerfile" \
--build-arg INSTALL_VER=${{ env.INSTALL_VER }} \
--tag ${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }} \
--cache-from=type=registry,ref=${{ env.IMAGE_NAME }}:cache \
--cache-to=type=registry,ref=${{ env.IMAGE_NAME }}:cache,mode=max \
--load \
"./Omada Dev"
- name: Build and push Docker image for release builds
if: startsWith(github.ref, 'refs/tags/')
uses: docker/build-push-action@v6
with:
push: true
tags: |
${{ env.IMAGE_NAME }}:${{ env.DOCKER_TAG }}
platforms: linux/amd64,linux/arm64
file: ${{ env.DOCKERFILE_PATH }}
context: ${{ env.CONTEXT_PATH }}
file: ./Omada Dev/Dockerfile
context: ./Omada Dev
cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:cache
cache-to: type=registry,ref=${{ env.IMAGE_NAME }}:cache,mode=max
build-args: |
INSTALL_VER=${{ env.INSTALL_VER }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Omada Dev/mbentley"]
path = Omada Dev/mbentley
url = https://github.com/mbentley/docker-omada-controller.git
16 changes: 11 additions & 5 deletions Omada Beta/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## beta-5.15.6.4 2024-11-16

- Restructured the repostory, mbentley is now a submodule
- Implemented pipeline
- Updated to the upstream version beta-5.15.6.4

## 5.14.32.3 - 2024-11-10

- Upgrade to 5.14.32.3
Expand All @@ -13,7 +19,7 @@
- only storing essential data (`data` and `logs`) in the persistent `/data` volume

## 5.14.7 - 2024-09-5
### Changed

- Updated to the upstream version 5.14.30.7

## 5.13.300 - 2023-03-28
Expand All @@ -26,17 +32,17 @@
- Support for using the SSL certificate from Home Assistant in Omada

## 5.13.3 - 2023-08-31

- Version bump to latest Omada Beta

## 5.9.3 - 2023-08-31
-Fix for the healthcheck Thanks nathanielks!

-Fix for the healthcheck Thanks nathanielks!

## 5.9.2 - 2023-04-3
### Added
- Updated to 5.9.31 image

- Updated to 5.9.31 image

## 5.9.1 - 2023-03-11
### Added

- Experimental support for AMD64 platforms.
22 changes: 17 additions & 5 deletions Omada Beta/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
# Home Assistant Omada Add-On
# Home Assistant Omada Add-On Beta

This add-on brings the Omada Controller directly into Home Assistant running on an 64 bit ARM or a x64 processor.

Omada Beta contains the most recent port of the [docker-omada-cotroller](https://github.com/mbentley/docker-omada-controller). If you need a more recent version, open an issue, or better submit a pull request.
Omada Beta contains the most recent port of the
[docker-omada-cotroller](https://github.com/mbentley/docker-omada-controller).
If you need a more recent version, open an issue, or better submit a pull request.

## Contribution

# Contribution
This add-on is a fork of Matt Bentleys [docker-omada-cotroller](https://github.com/mbentley/docker-omada-controller) and jkunczik [home-assistant-omada](https://github.com/jkunczik/home-assistant-omada) would not have been possible without thier excellent work. Other than in the original docker omada controller, this add-on stores all persistent data in the /data directory, so that it is compatible with Home assistant. This Add-On would not be possible without the effort of other people. Pull requests for version
updates or new features are always more than welcome. Special thanks goes to DraTrav for pushing this Add-On forward!
This add-on is a fork of Matt Bentleys
[docker-omada-cotroller](https://github.com/mbentley/docker-omada-controller),
and jkunczik [home-assistant-omada](https://github.com/jkunczik/home-assistant-omada)
would not have been possible without thier excellent work.
Other than in the original docker omada controller,
this add-on stores all persistent data in the /data directory,
so that it is compatible with Home assistant.
This Add-On would not be possible without the effort of other people.
Pull requests for version updates or new features are always more than welcome.
Special thanks goes to DraTrav for pushing this Add-On forward!
6 changes: 3 additions & 3 deletions Omada Beta/config.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
name: Omada Controller Beta
image: dratrav/home-assistant-omada-beta # <-- comment out for local build
version: 5.14.32.3
slug: omada_controller
image: jeruntu/home-assistant-omada-beta
version: beta-5.15.6.4
slug: omada_controller_beta
description: TP-Link Omada Controller software
webui: https://[HOST]:[PORT:8043]
startup: application
Expand Down
Loading

0 comments on commit 9125711

Please sign in to comment.