Skip to content

use regctl to get image information #71

use regctl to get image information

use regctl to get image information #71

Workflow file for this run

---
name: docker build
on:
push:
paths-ignore:
- 'README.md'
- 'LICENSE'
repository_dispatch: ~
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
include:
- dockerfile: Dockerfile
mainTag: latest
prepend: ""
- dockerfile: Dockerfile.alpine
mainTag: alpine
prepend: alpine-
steps:
- uses: actions/checkout@v4.1.1
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v3.0.0
- name: Setup the Regctl utility
uses: vookimedlo/setup-regctl@v1.0.1
- name: Version check
shell: bash
env:
MAINTAG: ${{ matrix.mainTag }}
run: |
# start of script
image_info=$(regctl image config devster31/qbittorrent-filebot:"${MAINTAG}" --format "{{ jsonPretty .Config }}")
EXT_S6_VER=$(echo "${image_info}" | jq -r 'try (.Labels."org.opencontainers.image.s6-overlay.version")')
EXT_FB_VER=$(echo "${image_info}" | jq -r 'try (.Labels."org.opencontainers.image.filebot.version")')
EXT_QB_VER=$(echo "${image_info}" | jq -r 'try (.Labels."org.opencontainers.image.qbittorrent.version")')
EXT_VT_VER=$(echo "${image_info}" | jq -r 'try (.Labels."org.opencontainers.image.vuetorrent.version")')
S6_URL=https://api.github.com/repos/just-containers/s6-overlay/releases/latest
RESP=$(curl -Ls -w "%{http_code}" -o /dev/null "${S6_URL}")
if [ "${RESP}" == 200 ]; then
CUR_S6_VER=$(curl -sS "${S6_URL}" | jq --raw-output '.tag_name')
else
echo "::error ::Unable to get the URL:${S6_URL}"
exit 1
fi
VT_URL=https://api.github.com/repos/WDaan/VueTorrent/releases/latest
RESP=$(curl -Ls -w "%{http_code}" -o /dev/null "${VT_URL}")
if [ "${RESP}" == 200 ]; then
CUR_VT_VER=$(curl -sS "${VT_URL}" | jq --raw-output '.tag_name')
else
echo "::error ::Unable to get the URL:${VT_URL}"
exit 1
fi
FB_DEB_URL="https://get.filebot.net/deb/dists/stable/main/binary-amd64/Packages"
RESP=$(curl -Ls -w "%{http_code}" -o /dev/null "${FB_DEB_URL}")
if [ "${RESP}" == 200 ]; then
CUR_FB_VER=$(curl -sSX GET "${FB_DEB_URL}" | awk -F ': ' '/Version/{print $2;exit}')
else
echo "::error ::Unable to get the URL:${QB_DEB_URL}"
exit 1
fi
QB_DEB_URL=http://ppa.launchpad.net/qbittorrent-team/qbittorrent-stable/ubuntu/dists/lunar/main/binary-amd64/Packages.gz
QB_PKG=qbittorrent-nox
RESP=$(curl -Ls -w "%{http_code}" -o /dev/null "${QB_DEB_URL}")
if [ "${RESP}" == 200 ]; then
CUR_QB_VER=$(curl -sSX GET "${QB_DEB_URL}" | gunzip -c | \
awk -F ': ' "/Package: ${QB_PKG}/,/Version/{ y = \$0 } END { split(y, a) ; print a[2] }")
else
echo "::error ::Unable to get the URL:${QB_DEB_URL}"
exit 1
fi
SHORT_TAG=$(echo "${CUR_QB_VER}" | awk -F '[:~]' '{ print $2 }')
FULL_TAG=qbt-v$(echo "${CUR_QB_VER}" | awk -F '[:~]' '{ print $2 }')-fb-v"${CUR_FB_VER}"
if [ "${CUR_QB_VER}" != "${EXT_QB_VER}" ] || \
[ "${CUR_FB_VER}" != "${EXT_FB_VER}" ] || \
[ "${CUR_S6_VER//v}" != "${EXT_S6_VER}" ] || \
[ "${CUR_VT_VER//v}" != "${EXT_VT_VER}" ]; then
RUN_BUILD=yes
else
RUN_BUILD=no
fi
{
echo "short_tag=${SHORT_TAG}"
echo "full_tag=${FULL_TAG}"
echo "qb_version=${CUR_QB_VER}"
echo "fb_version=${CUR_FB_VER}"
echo "s6_version=${CUR_S6_VER//v}"
echo "vt_version=${CUR_VT_VER//v}"
echo "trigger=${RUN_BUILD}"
} >> "$GITHUB_OUTPUT"
id: version_check
- name: Docker Login
uses: docker/login-action@v3.0.0
with:
username: ${{ secrets.docker_hub_username }}
password: ${{ secrets.docker_hub_password }}
- name: Build and push Docker images
uses: docker/build-push-action@v5.1.0
if: success() && steps.version_check.outputs.trigger == 'yes'
with:
context: .
file: ./${{ matrix.dockerfile }}
push: true
build-args: |
SHORT_TAG_VER=${{ steps.version_check.outputs.short_tag }}
FULL_TAG_VER=${{ steps.version_check.outputs.full_tag }}
QBITTORRENT_VER=${{ steps.version_check.outputs.qb_version }}
FILEBOT_VER=${{ steps.version_check.outputs.fb_version }}
S6_OVERLAY_VER=${{ steps.version_check.outputs.s6_version }}
VUETORRENT_VER=${{ steps.version_check.outputs.vt_version }}
tags: |
devster31/qbittorrent-filebot:${{ matrix.mainTag }}
devster31/qbittorrent-filebot:${{ matrix.prepend }}${{ steps.version_check.outputs.short_tag }}
devster31/qbittorrent-filebot:${{ matrix.prepend }}${{ steps.version_check.outputs.full_tag }}
...