Skip to content

Commit

Permalink
Automate latest release TAG
Browse files Browse the repository at this point in the history
  • Loading branch information
NorthernMan54 authored and donavanbecker committed Jun 19, 2024
1 parent dd25172 commit 67d821f
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 21 deletions.
16 changes: 1 addition & 15 deletions .github/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,6 @@

changelog:
categories:
- title: Breaking Changes 🛠
- title: Homebridge Apt Package Manifest
labels:
- 'breaking change'
- title: Featured Changes ✨
labels:
- 'feature'
- 'enhancement'
- title: Bug Fixes 🐛
labels:
- 'fix'
- 'bugfix'
- 'bug'
- title: Other Changes
labels:
- "chore"
- "housekeeping"
- "*"
19 changes: 19 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,19 @@ jobs:
echo $VERSION_IMAGE_TAG
echo "VERSION_IMAGE_TAG=${VERSION_IMAGE_TAG}" >> $GITHUB_OUTPUT
- name: Set Package Versions
id: pkg_version
run: |
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
export HOMEBRIDGE_APT_PKG_VERSION=`get_latest_release "homebridge/homebridge-apt-pkg"`
export FFMPEG_VERSION=`get_latest_release "homebridge/ffmpeg-for-homebridge"`
echo "HOMEBRIDGE_APT_PKG_VERSION=${HOMEBRIDGE_APT_PKG_VERSION}" >> $GITHUB_OUTPUT
echo "FFMPEG_VERSION=${FFMPEG_VERSION}" >> $GITHUB_OUTPUT
- name: Log into GitHub Container registry
uses: docker/login-action@v3
with:
Expand All @@ -63,6 +76,9 @@ jobs:
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
build-args: |
HOMEBRIDGE_APT_PKG_VERSION=${{ steps.pkg_version.outputs.HOMEBRIDGE_APT_PKG_VERSION }}
FFMPEG_VERSION=${{ steps.pkg_version.outputs.FFMPEG_VERSION }}
tags: |
ghcr.io/homebridge/homebridge:latest
ghcr.io/homebridge/homebridge:ubuntu
Expand All @@ -84,6 +100,9 @@ jobs:
file: ./Dockerfile
platforms: linux/amd64,linux/arm/v7,linux/arm64
push: true
build-args: |
HOMEBRIDGE_APT_PKG_VERSION=${{ steps.pkg_version.outputs.HOMEBRIDGE_APT_PKG_VERSION }}
FFMPEG_VERSION=${{ steps.pkg_version.outputs.FFMPEG_VERSION }}
tags: |
homebridge/homebridge:latest
homebridge/homebridge:ubuntu
Expand Down
15 changes: 9 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ LABEL org.opencontainers.image.authors="homebridge"
LABEL org.opencontainers.image.url="https://github.com/homebridge/docker-homebridge"
LABEL org.opencontainers.image.licenses="GPL-3.0"

# update to latest releases prior to release
# Latest release is supplied as a build argument

ENV HOMEBRIDGE_PKG_VERSION=v1.2.1 \
FFMPEG_VERSION=v2.1.1
ARG HOMEBRIDGE_APT_PKG_VERSION
ARG FFMPEG_VERSION

ENV HOMEBRIDGE_APT_PKG_VERSION=${HOMEBRIDGE_APT_PKG_VERSION:-v1.2.1}
ENV FFMPEG_VERSION=${FFMPEG_VERSION:-v2.1.1}

ENV S6_OVERLAY_VERSION=3.1.1.2 \
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
Expand Down Expand Up @@ -65,9 +68,9 @@ RUN case "$(uname -m)" in \
*) echo "unsupported architecture"; exit 1 ;; \
esac \
&& set -x \
&& curl -sSLf -o /homebridge_${HOMEBRIDGE_PKG_VERSION}.deb https://github.com/homebridge/homebridge-apt-pkg/releases/download/${HOMEBRIDGE_PKG_VERSION}/homebridge_${HOMEBRIDGE_PKG_VERSION}_${DEB_ARCH}.deb \
&& dpkg -i /homebridge_${HOMEBRIDGE_PKG_VERSION}.deb \
&& rm -rf /homebridge_${HOMEBRIDGE_PKG_VERSION}.deb \
&& curl -sSLf -o /homebridge_${HOMEBRIDGE_APT_PKG_VERSION}.deb https://github.com/homebridge/homebridge-apt-pkg/releases/download/${HOMEBRIDGE_APT_PKG_VERSION}/homebridge_${HOMEBRIDGE_APT_PKG_VERSION}_${DEB_ARCH}.deb \
&& dpkg -i /homebridge_${HOMEBRIDGE_APT_PKG_VERSION}.deb \
&& rm -rf /homebridge_${HOMEBRIDGE_APT_PKG_VERSION}.deb \
&& chown -R root:root /opt/homebridge \
&& rm -rf /var/lib/homebridge

Expand Down
15 changes: 15 additions & 0 deletions test-build-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#! /bin/sh

get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}

export HOMEBRIDGE_APT_PKG_VERSION=`get_latest_release "homebridge/homebridge-apt-pkg"`
export FFMPEG_VERSION=`get_latest_release "homebridge/ffmpeg-for-homebridge"`

echo HOMEBRIDGE_APT_PKG_VERSION ${HOMEBRIDGE_APT_PKG_VERSION}
echo FFMPEG_VERSION ${FFMPEG_VERSION}

docker build -f ./Dockerfile --build-arg HOMEBRIDGE_APT_PKG_VERSION=${HOMEBRIDGE_APT_PKG_VERSION} --build-arg FFMPEG_VERSION=${FFMPEG_VERSION} -t 'docker-homebridge' .

0 comments on commit 67d821f

Please sign in to comment.