- Replace PIHOLE_VERSION with PIHOLE_DOCKER_TAG

- reorder some stuff in the main Dockerfile
- Remove the CORE/WEB/FTL_VERSION args/env vars
- tweaks to GHA build script after some hints from @crazy-max
- always checkout dev versions of Pi-hole for nightly build, also make sure we're using dev branch of this repo
- keep pihole checkout enabled for dev and nightly tags

Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
Adam Warner
2021-12-10 20:51:35 +00:00
parent 7049b5df03
commit 9a9ee41a45
9 changed files with 37 additions and 141 deletions

View File

@@ -9,7 +9,6 @@ on:
release:
types: [published]
jobs:
test:
runs-on: ubuntu-latest
@@ -31,26 +30,14 @@ jobs:
steps:
-
name: Checkout
if: github.event_name != 'schedule'
uses: actions/checkout@v2
-
name: Calculate the versions to use
id: variables
run: |
# 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/*/}")
# If we are building dev branch or nightly then we want to use the development branches of the core components
# otherwise they will be unset and the main branches will be pulled
if [ "${PIHOLE_VERSION}" = "dev" || "${PIHOLE_VERSION}" = "nightly" ]; then
CORE_VERSION=development
WEB_VERSION=devel
FTL_VERSION=development
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: Checkout dev branch if we are building nightly
if: github.event_name == 'schedule'
uses: actions/checkout@v2
with:
ref: dev
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
@@ -69,7 +56,9 @@ jobs:
flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/') }}
tags: |
${{ steps.variables.outputs.PIHOLE_VERSION }}
type=schedule
type=ref,event=branch
type=ref,event=tag
-
name: Login to DockerHub
uses: docker/login-action@v1
@@ -90,10 +79,7 @@ jobs:
context: .
platforms: linux/amd64, linux/arm64, linux/386, linux/arm/v7, linux/arm/v6, linux/ppc64le
build-args: |
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 }}
PIHOLE_DOCKER_TAG=${{ steps.meta.outputs.version }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@@ -1,75 +0,0 @@
name: Build & Deploy custom image manually
on:
workflow_dispatch:
inputs:
name:
description: 'Name of tag'
required: true
core:
description: 'Branch or tag of core repo'
required: false
web:
description: 'Branch or tag of web repo'
required: false
ftl:
description: 'Branch or tag of ftl repo'
required: false
jobs:
test:
runs-on: ubuntu-latest
env:
ARCH: amd64
DEBIAN_VERSION: buster
CORE_VERSION: ${{ github.event.inputs.core }}
WEB_VERSION: ${{ github.event.inputs.web }}
FTL_VERSION: ${{ github.event.inputs.ftl }}
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Run Tests
run: |
echo "Building ${ARCH}-${DEBIAN_VERSION}"
./gh-actions-test.sh
build-and-publish:
needs: test
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
-
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=${{ github.event.inputs.core }}
WEB_VERSION=${{ github.event.inputs.web }}
FTL_VERSION=${{ github.event.inputs.ftl }}
PIHOLE_VERSION=${{ github.event.inputs.name }}
push: true
tags: |
${{ secrets.DOCKERHUB_NAMESPACE }}/pihole:${{ github.event.inputs.name }}
ghcr.io/${{ github.repository_owner }}/pihole:${{ github.event.inputs.name }}