65 lines
1.6 KiB
YAML
65 lines
1.6 KiB
YAML
name: Test & Build
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
pull_request:
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
ARCH: amd64
|
|
DEBIAN_VERSION: buster
|
|
steps:
|
|
- name: Checkout Repo
|
|
uses: actions/checkout@v2
|
|
- 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: Docker meta
|
|
id: meta
|
|
uses: docker/metadata-action@v3
|
|
with:
|
|
images: pihole/pihole
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
-
|
|
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: Build and push
|
|
uses: docker/build-push-action@v2
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64,linux/i386,linux/arm/v7
|
|
build-args: |
|
|
PIHOLE_VERSION=${{ env.TAG }}
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }} |