1212env :
1313 dockerhub : ${{ secrets.DOCKERHUB_NAMESPACE }}/pihole
1414 ghcr : ghcr.io/${{ github.repository_owner }}/pihole
15- components_branch : ${{ github.event_name == 'schedule ' && 'development ' || 'master ' }}
15+ components_branch : ${{ github.event_name == 'release ' && 'master ' || 'development ' }}
1616
1717jobs :
1818 build :
@@ -40,17 +40,20 @@ jobs:
4040 platform=${{ matrix.platform }}
4141 echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
4242
43- - name : Checkout Repo
43+ - &checkout-repo
44+ name : Checkout Repo
4445 if : github.event_name != 'schedule'
4546 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4647
47- - name : Checkout dev branch if scheduled
48+ - &checkout-dev
49+ name : Checkout dev branch if scheduled
4850 if : github.event_name == 'schedule'
4951 uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
5052 with :
5153 ref : development
5254
53- - name : Docker meta
55+ - &docker-meta
56+ name : Docker meta
5457 id : meta
5558 uses : docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0
5659 with :
@@ -62,17 +65,18 @@ jobs:
6265 latest=${{ startsWith(github.ref, 'refs/tags/') }}
6366 tags : |
6467 type=schedule,pattern=nightly
65- type=ref,event=branch ,enable=${{ github.event_name != 'schedule ' }}
68+ type=raw,value=nightly ,enable=${{ github.event_name == 'push ' }}
6669 type=ref,event=tag
6770
68- -
71+ - &login-dockerhub
6972 name : Login to Docker Hub
7073 uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
7174 with :
7275 registry : docker.io
7376 username : ${{ secrets.DOCKERHUB_USER }}
7477 password : ${{ secrets.DOCKERHUB_PASS }}
75- -
78+
79+ - &login-ghcr
7680 name : Login to GitHub Container Registry
7781 uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
7882 with :
8589 with :
8690 platforms : ${{ matrix.platform}}
8791
88- - name : Set up Docker Buildx
92+ - &setup-buildx
93+ name : Set up Docker Buildx
8994 uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
9095
9196 - name : Build container and push by digest
@@ -126,15 +131,8 @@ jobs:
126131 needs :
127132 - build
128133 steps :
129- - name : Checkout Repo
130- if : github.event_name != 'schedule'
131- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
132-
133- - name : Checkout dev branch if scheduled
134- if : github.event_name == 'schedule'
135- uses : actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
136- with :
137- ref : development
134+ - *checkout-repo
135+ - *checkout-dev
138136
139137 - name : Download digests
140138 uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
@@ -143,38 +141,10 @@ jobs:
143141 pattern : digests-*
144142 merge-multiple : true
145143
146- - name : Set up Docker Buildx
147- uses : docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
148-
149- - name : Docker meta
150- id : meta
151- uses : actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
152- with :
153- github-token : ${{ secrets.GITHUB_TOKEN }}
154- images : |
155- ${{ env.dockerhub }}
156- ${{ env.ghcr }}
157- flavor : |
158- latest=${{ startsWith(github.ref, 'refs/tags/') }}
159- tags : |
160- type=schedule,pattern=nightly
161- type=ref,event=branch,enable=${{ github.event_name != 'schedule' }}
162- type=ref,event=tag
163-
164- -
165- name : Login to Docker Hub
166- uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
167- with :
168- registry : docker.io
169- username : ${{ secrets.DOCKERHUB_USER }}
170- password : ${{ secrets.DOCKERHUB_PASS }}
171- -
172- name : Login to GitHub Container Registry
173- uses : docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
174- with :
175- registry : ghcr.io
176- username : ${{ github.repository_owner }}
177- password : ${{ secrets.GITHUB_TOKEN }}
144+ - *setup-buildx
145+ - *docker-meta
146+ - *login-dockerhub
147+ - *login-ghcr
178148
179149 - name : Create manifest list and push (DockerHub and GitHub Container Registry)
180150 working-directory : /tmp/digests
0 commit comments