-
Notifications
You must be signed in to change notification settings - Fork 290
48 lines (40 loc) · 1.43 KB
/
pr-docker-image.yml
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
name: Publish Docker Image for PR
on:
workflow_dispatch: # Manual trigger
pull_request:
jobs:
build-and-push-pr-image:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Login to GitHub Container Registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Pihole version from Dockerfile
id: extract-version
run: |
VERSION=$(grep -oP '(?<=pihole/pihole:)\S+' docker/Dockerfile)
echo "Extracted pihole version is: $VERSION"
echo "PIHOLE_VERSION=$VERSION" >> "$GITHUB_OUTPUT"
- name: Build and push PR Docker image
uses: docker/[email protected]
with:
context: docker/
push: true
tags: |
ghcr.io/${{ github.repository_owner }}/docker-pihole-unbound:pr${{ github.event.number }}-${{ github.run_number }}-${{ github.sha }}
platforms: linux/amd64,linux/386,linux/arm/v6,linux/arm/v7,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max