@@ -3,10 +3,10 @@ name: docker-compose-ci
33on :
44 workflow_dispatch :
55 push :
6- branches : ["master "]
6+ branches : ["** "]
77 tags : ["v*.*.*"]
88 pull_request :
9- branches : ["master "]
9+ branches : ["** "]
1010
1111permissions :
1212 contents : read
@@ -19,7 +19,7 @@ concurrency:
1919
2020env :
2121 REPO_SLUG : centralized-logging
22- DOCKERHUB_NAMESPACE : " "
22+ DOCKERHUB_NAMESPACE : " " # set to mirror to Docker Hub or leave empty
2323 PLATFORMS : linux/amd64,linux/arm64
2424
2525jobs :
5555 if : >
5656 github.event_name != 'pull_request' &&
5757 (startsWith(github.ref, 'refs/heads/master') || startsWith(github.ref, 'refs/tags/v'))
58+ env :
59+ # Make secrets available as env so we can safely reference env.* in `if:`
60+ DOCKERHUB_USERNAME : ${{ secrets.DOCKERHUB_USERNAME }}
61+ DOCKERHUB_TOKEN : ${{ secrets.DOCKERHUB_TOKEN }}
5862 steps :
5963 - name : Checkout
6064 uses : actions/checkout@v4
@@ -106,11 +110,11 @@ jobs:
106110 password : ${{ secrets.GITHUB_TOKEN }}
107111
108112 - name : (Optional) Login to Docker Hub
109- if : ${{ env.DOCKERHUB_NAMESPACE != '' && secrets .DOCKERHUB_USERNAME != '' && secrets .DOCKERHUB_TOKEN != '' }}
113+ if : ${{ env.DOCKERHUB_NAMESPACE != '' && env .DOCKERHUB_USERNAME != '' && env .DOCKERHUB_TOKEN != '' }}
110114 uses : docker/login-action@v3
111115 with :
112- username : ${{ secrets .DOCKERHUB_USERNAME }}
113- password : ${{ secrets .DOCKERHUB_TOKEN }}
116+ username : ${{ env .DOCKERHUB_USERNAME }}
117+ password : ${{ env .DOCKERHUB_TOKEN }}
114118
115119 - name : Restore build cache
116120 uses : actions/cache@v4
@@ -143,7 +147,7 @@ jobs:
143147 mv /tmp/.buildx-cache-new /tmp/.buildx-cache
144148
145149 - name : Mirror to Docker Hub (optional)
146- if : ${{ env.DOCKERHUB_NAMESPACE != '' && secrets .DOCKERHUB_USERNAME != '' && secrets .DOCKERHUB_TOKEN != '' }}
150+ if : ${{ env.DOCKERHUB_NAMESPACE != '' && env .DOCKERHUB_USERNAME != '' && env .DOCKERHUB_TOKEN != '' }}
147151 run : |
148152 set -euo pipefail
149153 mirror() { local svc="$1"; shift; for t in "$@"; do tg="$(basename "$t")"; \
@@ -153,4 +157,4 @@ jobs:
153157 mapfile -t USER_TAGS <<< "${{ steps.meta_user.outputs.tags }}"
154158 mapfile -t API_TAGS <<< "${{ steps.meta_api.outputs.tags }}"
155159 mapfile -t WEB_TAGS <<< "${{ steps.meta_web.outputs.tags }}"
156- mirror userapi "${USER_TAGS[@]}"; mirror api "${API_TAGS[@]}"; mirror web "${WEB_TAGS[@]}"
160+ mirror userapi "${USER_TAGS[@]}"; mirror api "${API_TAGS[@]}"; mirror web "${WEB_TAGS[@]}"
0 commit comments