11# reusable workflow
22name : .build
33
4- # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions
54permissions :
65 contents : read
76
3029 steps :
3130 -
3231 name : Checkout
33- uses : actions/checkout@v4
32+ uses : actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
3433 -
3534 name : Create matrix
3635 id : platforms
4342 -
4443 name : Tags
4544 id : tags
46- uses : actions/github-script@v7
45+ uses : actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
4746 with :
4847 result-encoding : string
4948 script : |
6463 -
6564 name : Docker meta
6665 id : meta
67- uses : docker/metadata-action@v5
66+ uses : docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
6867 with :
6968 images : |
7069 ${{ env.DOCKERHUB_SLUG }}
8079 mv "${{ steps.meta.outputs.bake-file }}" "/tmp/bake-meta.json"
8180 -
8281 name : Upload meta bake definition
83- uses : actions/upload-artifact@v4
82+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
8483 with :
8584 name : bake-meta-${{ inputs.go_version }}
8685 path : /tmp/bake-meta.json
9089 build :
9190 runs-on : ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
9291 permissions :
93- # same as global permissions
94- contents : read
95- # required to push to GHCR
96- packages : write
92+ contents : read # same as global permissions
93+ packages : write # required to push to GHCR
9794 needs :
9895 - prepare
9996 strategy :
@@ -108,32 +105,32 @@ jobs:
108105 echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
109106 -
110107 name : Download meta bake definition
111- uses : actions/download-artifact@v4
108+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
112109 with :
113110 name : bake-meta-${{ inputs.go_version }}
114111 path : /tmp
115112 -
116113 name : Login to DockerHub
117114 if : github.event_name != 'pull_request'
118- uses : docker/login-action@v3
115+ uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
119116 with :
120117 username : ${{ secrets.DOCKER_USERNAME }}
121118 password : ${{ secrets.DOCKER_PASSWORD }}
122119 -
123120 name : Login to GHCR
124121 if : github.event_name != 'pull_request'
125- uses : docker/login-action@v3
122+ uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
126123 with :
127124 registry : ghcr.io
128125 username : ${{ github.repository_owner }}
129126 password : ${{ secrets.GITHUB_TOKEN }}
130127 -
131128 name : Set up Docker Buildx
132- uses : docker/setup-buildx-action@v3
129+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
133130 -
134131 name : Build
135132 id : bake
136- uses : docker/bake-action@v6
133+ uses : docker/bake-action@5be5f02ff8819ecd3092ea6b2e6261c31774f2b4 # v6.10.0
137134 with :
138135 files : |
139136 ./docker-bake.hcl
@@ -154,7 +151,7 @@ jobs:
154151 touch "/tmp/digests/${digest#sha256:}"
155152 -
156153 name : Upload digest
157- uses : actions/upload-artifact@v4
154+ uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
158155 with :
159156 name : digests-${{ inputs.go_version }}-${{ env.PLATFORM_PAIR }}
160157 path : /tmp/digests/*
@@ -165,38 +162,36 @@ jobs:
165162 runs-on : ubuntu-latest
166163 if : github.event_name != 'pull_request'
167164 permissions :
168- # same as global permissions
169- contents : read
170- # required to push to GHCR
171- packages : write
165+ contents : read # same as global permissions
166+ packages : write # required to push to GHCR
172167 needs :
173168 - build
174169 steps :
175170 -
176171 name : Download meta bake definition
177- uses : actions/download-artifact@v4
172+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
178173 with :
179174 name : bake-meta-${{ inputs.go_version }}
180175 path : /tmp
181176 -
182177 name : Download digests
183- uses : actions/download-artifact@v4
178+ uses : actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
184179 with :
185180 path : /tmp/digests
186181 pattern : digests-${{ inputs.go_version }}-*
187182 merge-multiple : true
188183 -
189184 name : Set up Docker Buildx
190- uses : docker/setup-buildx-action@v3
185+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
191186 -
192187 name : Login to DockerHub
193- uses : docker/login-action@v3
188+ uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
194189 with :
195190 username : ${{ secrets.DOCKER_USERNAME }}
196191 password : ${{ secrets.DOCKER_PASSWORD }}
197192 -
198193 name : Login to GHCR
199- uses : docker/login-action@v3
194+ uses : docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
200195 with :
201196 registry : ghcr.io
202197 username : ${{ github.repository_owner }}
0 commit comments