-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
95 lines (88 loc) · 3.09 KB
/
Copy pathbuild-and-publish.yml
File metadata and controls
95 lines (88 loc) · 3.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Build Image and Publish
on:
schedule:
- cron: "0 5 * * *"
push:
branches:
- development
release:
types: [published]
pull_request:
permissions:
contents: read
env:
components_branch: ${{ github.event_name == 'release' && 'master' || 'development' }}
jobs:
test:
if: github.event_name == 'pull_request'
runs-on: ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
platform:
- linux/amd64
- linux/386
- linux/arm/v6
- linux/arm/v7
- linux/arm64
- linux/riscv64
env:
CI_ARCH: ${{ matrix.platform }}
steps:
- name: Checkout Repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 #v7.0.0
- name: Set up QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 #v4.2.0
- name: Test
run: CIPLATFORM=${{ env.CI_ARCH }} bash test/run.sh
build-prepare:
runs-on: ubuntu-24.04
outputs:
components_branch: ${{ env.components_branch }}
steps:
# FIXME: can't use env object in reusable workflow inputs: https://github.com/orgs/community/discussions/26671
- run: echo "Exposing env vars for reusable workflow"
build:
uses: docker/github-builder/.github/workflows/build.yml@5f637c833aa76bc99372a1dc9a6f8bcd8056fb85 #v1.12.0
needs:
- build-prepare
permissions:
contents: read # same as global permissions
id-token: write # for signing attestation(s) with GitHub OIDC Token
packages: write # required to push to GHCR
with:
setup-qemu: true
cache: true
cache-scope: build
cache-mode: max
fail-fast: true
context: src
output: image
build-args: |
PIHOLE_DOCKER_TAG={{meta.version}}
FTL_BRANCH=${{ needs.build-prepare.outputs.components_branch }}
CORE_BRANCH=${{ needs.build-prepare.outputs.components_branch }}
WEB_BRANCH=${{ needs.build-prepare.outputs.components_branch }}
PADD_BRANCH=${{ needs.build-prepare.outputs.components_branch }}
platforms: linux/amd64,linux/386,linux/arm/v6,linux/arm/v7,linux/arm64,linux/riscv64
push: ${{ github.event_name != 'pull_request' }}
set-meta-labels: true
meta-images: |
pihole/pihole
ghcr.io/${{ github.repository_owner }}/pihole
meta-tags: |
type=schedule,pattern=nightly
type=raw,value=nightly,enable=${{ github.event_name == 'push' }}
type=ref,event=tag
meta-flavor: |
latest=${{ startsWith(github.ref, 'refs/tags/') }}
# FIXME: GHCR does not support the referrers API and spams the registry with sha-tagged images when cosigned: https://github.com/docker/github-builder/issues/109
sign: false
secrets:
registry-auths: |
- registry: docker.io
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASS }}
- registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}