mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2024-06-26 00:59:07 +02:00
Combine nightly and main workflows into one. Tested functionality on a fork so this can come straight into dev
use dev images for the dev branch build. Only disable pihole checkout on released tags - allow it in dev and nightly tags Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
parent
ff776c2ba4
commit
27bdf81665
70
.github/workflows/nightly-build.yml
vendored
70
.github/workflows/nightly-build.yml
vendored
|
@ -1,70 +0,0 @@
|
||||||
name: Build & Deploy Nightly images
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '0 2 * * *'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
ARCH: amd64
|
|
||||||
DEBIAN_VERSION: buster
|
|
||||||
CORE_VERSION: development
|
|
||||||
WEB_VERSION: devel
|
|
||||||
FTL_VERSION: development
|
|
||||||
steps:
|
|
||||||
- name: Checkout Repo
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
ref: dev
|
|
||||||
- name: Run Tests
|
|
||||||
run: |
|
|
||||||
echo "Building ${ARCH}-${DEBIAN_VERSION}"
|
|
||||||
./gh-actions-test.sh
|
|
||||||
|
|
||||||
build-and-publish:
|
|
||||||
if: github.event_name != 'pull_request'
|
|
||||||
needs: test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
-
|
|
||||||
name: Get the tag name
|
|
||||||
run: |
|
|
||||||
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
|
||||||
-
|
|
||||||
name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v1
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v1
|
|
||||||
-
|
|
||||||
name: Login to DockerHub
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USER }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_PASS }}
|
|
||||||
-
|
|
||||||
name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v1
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
-
|
|
||||||
name: Build and push
|
|
||||||
uses: docker/build-push-action@v2
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
platforms: linux/amd64, linux/arm64, linux/386, linux/arm/v7, linux/arm/v6, linux/ppc64le
|
|
||||||
build-args: |
|
|
||||||
CORE_VERSION=development
|
|
||||||
WEB_VERSION=devel
|
|
||||||
FTL_VERSION=development
|
|
||||||
PIHOLE_VERSION=nightly
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
${{ secrets.DOCKERHUB_NAMESPACE }}/pihole:nightly
|
|
||||||
ghcr.io/${{ github.repository_owner }}/pihole:nightly
|
|
51
.github/workflows/test-and-build.yaml
vendored
51
.github/workflows/test-and-build.yaml
vendored
|
@ -1,5 +1,7 @@
|
||||||
name: Test & Build
|
name: Test & Build
|
||||||
on:
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 2 * * *'
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
|
@ -7,6 +9,7 @@ on:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -30,31 +33,50 @@ jobs:
|
||||||
name: Checkout
|
name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
-
|
-
|
||||||
name: Get the tag name
|
name: Calculate the versions to use
|
||||||
|
id: variables
|
||||||
run: |
|
run: |
|
||||||
echo "TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
|
# If trigged by schedule then container tag will be nightly, else it's either dev or whatever the tagged version number is
|
||||||
-
|
PIHOLE_VERSION=$([ "${{ github.event_name == 'schedule' }}" = "true" ] && echo "nightly" || echo "${GITHUB_REF#refs/*/}")
|
||||||
name: Docker meta
|
|
||||||
id: meta
|
# If we are building dev branch or nightly then we want to use the development branches of the core components
|
||||||
uses: docker/metadata-action@v3
|
# otherwise they will be unset and the main branches will be pulled
|
||||||
with:
|
if [ "${PIHOLE_VERSION}" = "dev" || "${PIHOLE_VERSION}" = "nightly" ]; then
|
||||||
images: |
|
CORE_VERSION=development
|
||||||
${{ secrets.DOCKERHUB_NAMESPACE }}/pihole
|
WEB_VERSION=devel
|
||||||
ghcr.io/${{ github.repository_owner }}/pihole
|
FTL_VERSION=development
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
fi
|
||||||
|
|
||||||
|
echo ::set-output name=CORE_VERSION::${CORE_VERSION}
|
||||||
|
echo ::set-output name=WEB_VERSION::${WEB_VERSION}
|
||||||
|
echo ::set-output name=FTL_VERSION::${FTL_VERSION}
|
||||||
|
echo ::set-output name=PIHOLE_VERSION::${PIHOLE_VERSION}
|
||||||
-
|
-
|
||||||
name: Set up QEMU
|
name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v1
|
uses: docker/setup-qemu-action@v1
|
||||||
-
|
-
|
||||||
name: Set up Docker Buildx
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v1
|
uses: docker/setup-buildx-action@v1
|
||||||
|
-
|
||||||
|
name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v3
|
||||||
|
with:
|
||||||
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
images: |
|
||||||
|
${{ secrets.DOCKERHUB_NAMESPACE }}/pihole
|
||||||
|
ghcr.io/${{ github.repository_owner }}/pihole
|
||||||
|
flavor: |
|
||||||
|
latest=${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
tags: |
|
||||||
|
${{ steps.variables.outputs.PIHOLE_VERSION }}
|
||||||
-
|
-
|
||||||
name: Login to DockerHub
|
name: Login to DockerHub
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USER }}
|
username: ${{ secrets.DOCKERHUB_USER }}
|
||||||
password: ${{ secrets.DOCKERHUB_PASS }}
|
password: ${{ secrets.DOCKERHUB_PASS }}
|
||||||
-
|
-
|
||||||
name: Login to GitHub Container Registry
|
name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v1
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
|
@ -68,7 +90,10 @@ jobs:
|
||||||
context: .
|
context: .
|
||||||
platforms: linux/amd64, linux/arm64, linux/386, linux/arm/v7, linux/arm/v6, linux/ppc64le
|
platforms: linux/amd64, linux/arm64, linux/386, linux/arm/v7, linux/arm/v6, linux/ppc64le
|
||||||
build-args: |
|
build-args: |
|
||||||
PIHOLE_VERSION=${{ env.TAG }}
|
CORE_VERSION=${{ steps.variables.outputs.CORE_VERSION }}
|
||||||
|
WEB_VERSION=${{ steps.variables.outputs.WEB_VERSION }}
|
||||||
|
FTL_VERSION=${{ steps.variables.outputs.FTL_VERSION }}
|
||||||
|
PIHOLE_VERSION=${{ steps.variables.outputs.PIHOLE_VERSION }}
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
|
@ -78,13 +78,16 @@ sed -i $'s/helpFunc() {/unsupportedFunc() {\\\n echo "Function not supported in
|
||||||
# Replace a few of the `pihole` options with calls to `unsupportedFunc`:
|
# Replace a few of the `pihole` options with calls to `unsupportedFunc`:
|
||||||
# pihole -up / pihole updatePihole
|
# pihole -up / pihole updatePihole
|
||||||
sed -i $'s/)\s*updatePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
sed -i $'s/)\s*updatePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
||||||
# pihole checkout
|
|
||||||
sed -i $'s/)\s*piholeCheckoutFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
|
||||||
# pihole -r / pihole reconfigure
|
# pihole -r / pihole reconfigure
|
||||||
sed -i $'s/)\s*reconfigurePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
sed -i $'s/)\s*reconfigurePiholeFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
||||||
# pihole uninstall
|
# pihole uninstall
|
||||||
sed -i $'s/)\s*uninstallFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
sed -i $'s/)\s*uninstallFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
||||||
|
|
||||||
|
if [[ "${PIHOLE_VERSION}" != "dev" && "${PIHOLE_VERSION}" != "nightly" ]]; then
|
||||||
|
# If we are on a version other than dev or nightly, disable `pihole checkout`
|
||||||
|
sed -i $'s/)\s*piholeCheckoutFunc/) unsupportedFunc/g' /usr/local/bin/pihole
|
||||||
|
fi
|
||||||
|
|
||||||
# Inject a message into the debug scripts Operating System section to indicate that the debug log comes from a Docker system.
|
# Inject a message into the debug scripts Operating System section to indicate that the debug log comes from a Docker system.
|
||||||
sed -i $'s/echo_current_diagnostic "Operating system"/echo_current_diagnostic "Operating system"\\\n log_write "${INFO} Pi-hole Docker Container: ${PIHOLE_VERSION:-PIHOLE_VERSION is unset}"/g' /opt/pihole/piholeDebug.sh
|
sed -i $'s/echo_current_diagnostic "Operating system"/echo_current_diagnostic "Operating system"\\\n log_write "${INFO} Pi-hole Docker Container: ${PIHOLE_VERSION:-PIHOLE_VERSION is unset}"/g' /opt/pihole/piholeDebug.sh
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user