mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-10-31 04:01:59 +01:00
Merge pull request #396 from yellowcooln/ci/versioned-docker-tags
ci: publish versioned Docker image tags
This commit is contained in:
5 files changed
+36
-29
No files matched your search
@@ -11,8 +11,8 @@ on:
|
|||||||
description: "Docker image repository to publish to"
|
description: "Docker image repository to publish to"
|
||||||
required: false
|
required: false
|
||||||
default: ""
|
default: ""
|
||||||
pymc_console_version:
|
openhop_console_version:
|
||||||
description: "PyMC Console release to bundle (latest or a tag such as v0.9.333)"
|
description: "openHop Console release to bundle (latest or a tag such as v0.9.333)"
|
||||||
required: false
|
required: false
|
||||||
default: "latest"
|
default: "latest"
|
||||||
|
|
||||||
@@ -46,6 +46,10 @@ jobs:
|
|||||||
- name: Compute package version
|
- name: Compute package version
|
||||||
id: package_version
|
id: package_version
|
||||||
run: |
|
run: |
|
||||||
|
if [ "${{ github.repository }}" != "openhop-dev/openhop_repeater" ]; then
|
||||||
|
git fetch --force https://github.com/openhop-dev/openhop_repeater.git \
|
||||||
|
"refs/tags/*:refs/tags/*"
|
||||||
|
fi
|
||||||
python -m pip install --disable-pip-version-check setuptools_scm
|
python -m pip install --disable-pip-version-check setuptools_scm
|
||||||
version="$(python -m setuptools_scm)"
|
version="$(python -m setuptools_scm)"
|
||||||
echo "version=${version}" >> "$GITHUB_OUTPUT"
|
echo "version=${version}" >> "$GITHUB_OUTPUT"
|
||||||
@@ -63,7 +67,7 @@ jobs:
|
|||||||
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.image_repository }}" ]; then
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ -n "${{ inputs.image_repository }}" ]; then
|
||||||
image_repository="${{ inputs.image_repository }}"
|
image_repository="${{ inputs.image_repository }}"
|
||||||
elif [ "${{ github.repository_owner }}" = "yellowcooln" ]; then
|
elif [ "${{ github.repository_owner }}" = "yellowcooln" ]; then
|
||||||
image_repository="yellowcooln/pymc-repeater"
|
image_repository="yellowcooln/openhop-repeater"
|
||||||
else
|
else
|
||||||
image_repository="openhop/openhop-repeater"
|
image_repository="openhop/openhop-repeater"
|
||||||
fi
|
fi
|
||||||
@@ -71,11 +75,11 @@ jobs:
|
|||||||
echo "Using image repository: ${image_repository}"
|
echo "Using image repository: ${image_repository}"
|
||||||
echo "image_repository=${image_repository}" >> "$GITHUB_OUTPUT"
|
echo "image_repository=${image_repository}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Resolve bundled Console release
|
- name: Resolve bundled openHop Console release
|
||||||
id: console_release
|
id: console_release
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
REQUESTED_CONSOLE_VERSION: ${{ inputs.pymc_console_version || 'latest' }}
|
REQUESTED_CONSOLE_VERSION: ${{ inputs.openhop_console_version || 'latest' }}
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -89,7 +93,7 @@ jobs:
|
|||||||
cache_bust="${REQUESTED_CONSOLE_VERSION}"
|
cache_bust="${REQUESTED_CONSOLE_VERSION}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Bundling PyMC Console ${tag}"
|
echo "Bundling openHop Console ${tag}"
|
||||||
echo "version=${REQUESTED_CONSOLE_VERSION}" >> "$GITHUB_OUTPUT"
|
echo "version=${REQUESTED_CONSOLE_VERSION}" >> "$GITHUB_OUTPUT"
|
||||||
echo "cache_bust=${cache_bust}" >> "$GITHUB_OUTPUT"
|
echo "cache_bust=${cache_bust}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
@@ -101,6 +105,7 @@ jobs:
|
|||||||
tags: |
|
tags: |
|
||||||
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
|
type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }}
|
||||||
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
type=raw,value=dev,enable=${{ github.ref == 'refs/heads/dev' }}
|
||||||
|
type=raw,value=v${{ steps.package_version.outputs.version }}
|
||||||
type=sha,format=short
|
type=sha,format=short
|
||||||
|
|
||||||
- name: Build and push
|
- name: Build and push
|
||||||
@@ -112,15 +117,17 @@ jobs:
|
|||||||
push: true
|
push: true
|
||||||
build-args: |
|
build-args: |
|
||||||
PACKAGE_VERSION=${{ steps.package_version.outputs.version }}
|
PACKAGE_VERSION=${{ steps.package_version.outputs.version }}
|
||||||
PYMC_CONSOLE_VERSION=${{ steps.console_release.outputs.version }}
|
OPENHOP_CONSOLE_VERSION=${{ steps.console_release.outputs.version }}
|
||||||
PYMC_CONSOLE_CACHE_BUST=${{ steps.console_release.outputs.cache_bust }}
|
OPENHOP_CONSOLE_CACHE_BUST=${{ steps.console_release.outputs.cache_bust }}
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
|
|
||||||
- name: Notify Home Assistant add-on repository
|
- name: Notify Home Assistant add-on repository
|
||||||
if: github.repository == 'openhop-dev/openhop_repeater'
|
if: >-
|
||||||
|
github.repository == 'openhop-dev/openhop_repeater' &&
|
||||||
|
(github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev')
|
||||||
env:
|
env:
|
||||||
DISPATCH_TOKEN: ${{ secrets.HA_ADDON_REPO_DISPATCH_TOKEN }}
|
DISPATCH_TOKEN: ${{ secrets.HA_ADDON_REPO_DISPATCH_TOKEN }}
|
||||||
CHANNEL: ${{ github.ref_name }}
|
CHANNEL: ${{ github.ref_name }}
|
||||||
|
|||||||
@@ -429,12 +429,12 @@ that source as a directory, which breaks startup.
|
|||||||
docker compose up -d
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
The Docker image bundles the optional PyMC Console frontend at
|
The Docker image bundles the optional openHop Console frontend at
|
||||||
`/opt/pymc_console/web/html`. Local builds with `docker-compose.build.yml`
|
`/opt/pymc_console/web/html`. Local builds with `docker-compose.build.yml`
|
||||||
download the newest PyMC Console release by default. Set `PYMC_CONSOLE_VERSION`
|
download the newest openHop Console release by default. Set `OPENHOP_CONSOLE_VERSION`
|
||||||
in `.env` to pin a release tag such as `v0.9.329`.
|
in `.env` to pin a release tag such as `v0.9.329`.
|
||||||
|
|
||||||
After the container starts, open Web Settings and choose `PyMC Console` as the
|
After the container starts, open Web Settings and choose `openHop Console` as the
|
||||||
web frontend if you want the repeater to serve that UI. The existing
|
web frontend if you want the repeater to serve that UI. The existing
|
||||||
`/api/check_pymc_console` endpoint should report that the Console path exists.
|
`/api/check_pymc_console` endpoint should report that the Console path exists.
|
||||||
|
|
||||||
|
|||||||
@@ -10,4 +10,4 @@ services:
|
|||||||
DIALOUT_GID: ${DIALOUT_GID:-20}
|
DIALOUT_GID: ${DIALOUT_GID:-20}
|
||||||
GPIO_GID: ${GPIO_GID:-986}
|
GPIO_GID: ${GPIO_GID:-986}
|
||||||
SPI_GID: ${SPI_GID:-989}
|
SPI_GID: ${SPI_GID:-989}
|
||||||
PYMC_CONSOLE_VERSION: ${PYMC_CONSOLE_VERSION:-latest}
|
OPENHOP_CONSOLE_VERSION: ${OPENHOP_CONSOLE_VERSION:-${PYMC_CONSOLE_VERSION:-latest}}
|
||||||
+13
-13
@@ -10,14 +10,14 @@ ARG GPIO_GID=986
|
|||||||
ARG SPI_GID=989
|
ARG SPI_GID=989
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG YQ_VERSION=v4.40.5
|
ARG YQ_VERSION=v4.40.5
|
||||||
ARG PYMC_CONSOLE_REPO=Treehouse-00/pymc_console-dist
|
ARG OPENHOP_CONSOLE_REPO=Treehouse-00/pymc_console-dist
|
||||||
ARG PYMC_CONSOLE_VERSION=latest
|
ARG OPENHOP_CONSOLE_VERSION=latest
|
||||||
ARG PYMC_CONSOLE_CACHE_BUST=default
|
ARG OPENHOP_CONSOLE_CACHE_BUST=default
|
||||||
|
|
||||||
ENV INSTALL_DIR=/opt/openhop_repeater \
|
ENV INSTALL_DIR=/opt/openhop_repeater \
|
||||||
CONFIG_DIR=/etc/openhop_repeater \
|
CONFIG_DIR=/etc/openhop_repeater \
|
||||||
DATA_DIR=/var/lib/openhop_repeater \
|
DATA_DIR=/var/lib/openhop_repeater \
|
||||||
PYMC_CONSOLE_WEB_DIR=/opt/pymc_console/web/html \
|
OPENHOP_CONSOLE_WEB_DIR=/opt/pymc_console/web/html \
|
||||||
HOME_DIR=/home/${USER} \
|
HOME_DIR=/home/${USER} \
|
||||||
PATH=/home/${USER}/.local/bin:${PATH} \
|
PATH=/home/${USER}/.local/bin:${PATH} \
|
||||||
PYTHONUNBUFFERED=1 \
|
PYTHONUNBUFFERED=1 \
|
||||||
@@ -53,21 +53,21 @@ RUN arch="${TARGETARCH:-}" \
|
|||||||
&& wget -qO /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}" \
|
&& wget -qO /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/${YQ_BINARY}" \
|
||||||
&& chmod +x /usr/local/bin/yq
|
&& chmod +x /usr/local/bin/yq
|
||||||
|
|
||||||
# Bundle the optional PyMC Console frontend so the web UI can select it without
|
# Bundle the optional openHop Console frontend so the web UI can select it without
|
||||||
# requiring a host bind mount. Use PYMC_CONSOLE_VERSION=latest to pull the
|
# requiring a host bind mount. Use OPENHOP_CONSOLE_VERSION=latest to pull the
|
||||||
# newest release at image build time, or pin a tag such as v0.9.329.
|
# newest release at image build time, or pin a tag such as v0.9.329.
|
||||||
RUN set -eux; \
|
RUN set -eux; \
|
||||||
echo "Bundling PyMC Console cache key: ${PYMC_CONSOLE_CACHE_BUST}"; \
|
echo "Bundling openHop Console cache key: ${OPENHOP_CONSOLE_CACHE_BUST}"; \
|
||||||
mkdir -p "${PYMC_CONSOLE_WEB_DIR}"; \
|
mkdir -p "${OPENHOP_CONSOLE_WEB_DIR}"; \
|
||||||
if [ "${PYMC_CONSOLE_VERSION}" = "latest" ]; then \
|
if [ "${OPENHOP_CONSOLE_VERSION}" = "latest" ]; then \
|
||||||
console_url="https://github.com/${PYMC_CONSOLE_REPO}/releases/latest/download/pymc-ui-latest.tar.gz"; \
|
console_url="https://github.com/${OPENHOP_CONSOLE_REPO}/releases/latest/download/pymc-ui-latest.tar.gz"; \
|
||||||
else \
|
else \
|
||||||
console_url="https://github.com/${PYMC_CONSOLE_REPO}/releases/download/${PYMC_CONSOLE_VERSION}/pymc-ui-${PYMC_CONSOLE_VERSION}.tar.gz"; \
|
console_url="https://github.com/${OPENHOP_CONSOLE_REPO}/releases/download/${OPENHOP_CONSOLE_VERSION}/pymc-ui-${OPENHOP_CONSOLE_VERSION}.tar.gz"; \
|
||||||
fi; \
|
fi; \
|
||||||
wget -qO /tmp/pymc-console.tar.gz "${console_url}"; \
|
wget -qO /tmp/pymc-console.tar.gz "${console_url}"; \
|
||||||
tar -xzf /tmp/pymc-console.tar.gz -C "${PYMC_CONSOLE_WEB_DIR}"; \
|
tar -xzf /tmp/pymc-console.tar.gz -C "${OPENHOP_CONSOLE_WEB_DIR}"; \
|
||||||
rm /tmp/pymc-console.tar.gz; \
|
rm /tmp/pymc-console.tar.gz; \
|
||||||
test -f "${PYMC_CONSOLE_WEB_DIR}/index.html"
|
test -f "${OPENHOP_CONSOLE_WEB_DIR}/index.html"
|
||||||
|
|
||||||
# Create the group and user in order to run without root privileges
|
# Create the group and user in order to run without root privileges
|
||||||
RUN groupadd --gid "$PGID" "$GROUP" \
|
RUN groupadd --gid "$PGID" "$GROUP" \
|
||||||
|
|||||||
+3
-3
@@ -30,8 +30,8 @@ SPI_GID=989
|
|||||||
PUID=15888
|
PUID=15888
|
||||||
PGID=15888
|
PGID=15888
|
||||||
|
|
||||||
# Local build only. The Docker image bundles PyMC Console under
|
# Local build only. The Docker image bundles openHop Console under
|
||||||
# /opt/pymc_console/web/html so it is available in Web Settings without a host
|
# /opt/pymc_console/web/html so it is available in Web Settings without a host
|
||||||
# bind mount. Use "latest" to pull the newest pyMC Console release at build
|
# bind mount. Use "latest" to pull the newest openHop Console release at build
|
||||||
# time, or pin a tag such as v0.9.329.
|
# time, or pin a tag such as v0.9.329.
|
||||||
PYMC_CONSOLE_VERSION=latest
|
OPENHOP_CONSOLE_VERSION=latest
|
||||||
Reference in new issue
Block a user