mirror of
https://github.com/pi-hole/docker-pi-hole.git
synced 2025-12-20 02:18:51 +00:00
Utilise YAML anchors to reduce repeats of certain steps
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
This commit is contained in:
66
.github/workflows/build-and-publish.yml
vendored
66
.github/workflows/build-and-publish.yml
vendored
@@ -40,17 +40,20 @@ jobs:
|
|||||||
platform=${{ matrix.platform }}
|
platform=${{ matrix.platform }}
|
||||||
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Checkout Repo
|
- &checkout-repo
|
||||||
|
name: Checkout Repo
|
||||||
if: github.event_name != 'schedule'
|
if: github.event_name != 'schedule'
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
|
||||||
|
|
||||||
- name: Checkout dev branch if scheduled
|
- &checkout-dev
|
||||||
|
name: Checkout dev branch if scheduled
|
||||||
if: github.event_name == 'schedule'
|
if: github.event_name == 'schedule'
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
|
||||||
with:
|
with:
|
||||||
ref: development
|
ref: development
|
||||||
|
|
||||||
- name: Docker meta
|
- &docker-meta
|
||||||
|
name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f #v5.8.0
|
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f #v5.8.0
|
||||||
with:
|
with:
|
||||||
@@ -62,17 +65,18 @@ jobs:
|
|||||||
latest=${{ startsWith(github.ref, 'refs/tags/') }}
|
latest=${{ startsWith(github.ref, 'refs/tags/') }}
|
||||||
tags: |
|
tags: |
|
||||||
type=schedule,pattern=nightly
|
type=schedule,pattern=nightly
|
||||||
type=ref,event=branch,enable=${{ github.event_name != 'schedule' }},pattern=nightly
|
type=raw,value=nightly,enable=${{ github.event_name == 'push' }}
|
||||||
type=ref,event=tag
|
type=ref,event=tag
|
||||||
|
|
||||||
-
|
- &login-dockerhub
|
||||||
name: Login to Docker Hub
|
name: Login to Docker Hub
|
||||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef #v3.6.0
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef #v3.6.0
|
||||||
with:
|
with:
|
||||||
registry: docker.io
|
registry: docker.io
|
||||||
username: ${{ secrets.DOCKERHUB_USER }}
|
username: ${{ secrets.DOCKERHUB_USER }}
|
||||||
password: ${{ secrets.DOCKERHUB_PASS }}
|
password: ${{ secrets.DOCKERHUB_PASS }}
|
||||||
-
|
|
||||||
|
- &login-ghcr
|
||||||
name: Login to GitHub Container Registry
|
name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef #v3.6.0
|
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef #v3.6.0
|
||||||
with:
|
with:
|
||||||
@@ -85,7 +89,8 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
platforms: ${{ matrix.platform}}
|
platforms: ${{ matrix.platform}}
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- &setup-buildx
|
||||||
|
name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 #v3.11.1
|
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 #v3.11.1
|
||||||
|
|
||||||
- name: Build container and push by digest
|
- name: Build container and push by digest
|
||||||
@@ -126,15 +131,8 @@ jobs:
|
|||||||
needs:
|
needs:
|
||||||
- build
|
- build
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repo
|
- *checkout-repo
|
||||||
if: github.event_name != 'schedule'
|
- *checkout-dev
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
|
|
||||||
|
|
||||||
- name: Checkout dev branch if scheduled
|
|
||||||
if: github.event_name == 'schedule'
|
|
||||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
|
|
||||||
with:
|
|
||||||
ref: development
|
|
||||||
|
|
||||||
- name: Download digests
|
- name: Download digests
|
||||||
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 #v5.0.0
|
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 #v5.0.0
|
||||||
@@ -143,38 +141,10 @@ jobs:
|
|||||||
pattern: digests-*
|
pattern: digests-*
|
||||||
merge-multiple: true
|
merge-multiple: true
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- *setup-buildx
|
||||||
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 #v3.11.1
|
- *docker-meta
|
||||||
|
- *login-dockerhub
|
||||||
- name: Docker meta
|
- *login-ghcr
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f #v5.8.0
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
images: |
|
|
||||||
${{ env.dockerhub }}
|
|
||||||
${{ env.ghcr }}
|
|
||||||
flavor: |
|
|
||||||
latest=${{ startsWith(github.ref, 'refs/tags/') }}
|
|
||||||
tags: |
|
|
||||||
type=schedule,pattern=nightly
|
|
||||||
type=ref,event=branch,enable=${{ github.event_name != 'schedule' }},pattern=nightly
|
|
||||||
type=ref,event=tag
|
|
||||||
|
|
||||||
-
|
|
||||||
name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef #v3.6.0
|
|
||||||
with:
|
|
||||||
registry: docker.io
|
|
||||||
username: ${{ secrets.DOCKERHUB_USER }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_PASS }}
|
|
||||||
-
|
|
||||||
name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef #v3.6.0
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Create manifest list and push (DockerHub and GitHub Container Registry)
|
- name: Create manifest list and push (DockerHub and GitHub Container Registry)
|
||||||
working-directory: /tmp/digests
|
working-directory: /tmp/digests
|
||||||
|
|||||||
Reference in New Issue
Block a user