Skip to content

Commit 9a1797d

Browse files
authored
Login to dockerhub (#478)
* persist credentials * login to dockerhub * use env * don't use env
1 parent f8362df commit 9a1797d

5 files changed

Lines changed: 58 additions & 1 deletion

File tree

.github/actions/build-and-publish-image/action.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ inputs:
4545
default: ""
4646
required: false
4747
description: "Password used to log in to the container registry"
48+
dockerhub-username:
49+
default: ""
50+
required: false
51+
description: "Username used to log in to dockerhub"
52+
dockerhub-password:
53+
default: ""
54+
required: false
55+
description: "Password used to log in to dockerhub"
4856
secret-files:
4957
default: ""
5058
required: false
@@ -93,6 +101,13 @@ runs:
93101
registry: ${{ inputs.registry-url }}
94102
username: ${{ inputs.registry-username }}
95103
password: ${{ inputs.registry-password }}
104+
- if: ${{ inputs.dockerhub-username != '' }}
105+
name: Login to DockerHub
106+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
107+
with:
108+
registry: "docker.io"
109+
username: ${{ inputs.dockerhub-username }}
110+
password: ${{ inputs.dockerhub-password }}
96111
- name: Build image
97112
id: build
98113
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7

.github/workflows/build-and-push-image.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ on:
5757
secrets:
5858
SCCACHE_GH_PAT:
5959
required: false
60+
GPUCIBOT_DOCKERHUB_USER:
61+
required: false
62+
GPUCIBOT_DOCKERHUB_TOKEN:
63+
required: false
6064

6165
permissions:
6266
actions: none
@@ -254,6 +258,8 @@ jobs:
254258
registry-url: ${{ env.REGISTRY }}
255259
registry-username: ${{ github.actor }}
256260
registry-password: ${{ github.token }}
261+
dockerhub-username: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
262+
dockerhub-password: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
257263
secret-files: |
258264
${{ env.SECRET_FILES }}
259265
build-args: |

.github/workflows/docs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
with:
3333
ref: gh-pages
3434
path: gh-pages
35-
persist-credentials: false
35+
persist-credentials: true
3636
- name: Build Docs
3737
working-directory: main
3838
run: |

.github/workflows/main.pr.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
DOCKER_BUILDKIT: "1"
3434
DOCKER_CLI_HINTS: "false"
3535
DOCKER_SCAN_SUGGEST: "false"
36+
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
3637
permissions:
3738
contents: write
3839
id-token: write
@@ -161,6 +162,21 @@ jobs:
161162
with:
162163
tool_cache: ${{ runner.tool_cache }}
163164

165+
- name: Login to ghcr.io
166+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
167+
with:
168+
registry: "ghcr.io"
169+
username: ${{ github.actor }}
170+
password: ${{ github.token }}
171+
172+
- if: ${{ env.GPUCIBOT_DOCKERHUB_USER != '' }}
173+
name: Login to DockerHub
174+
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
175+
with:
176+
registry: "docker.io"
177+
username: ${{ env.GPUCIBOT_DOCKERHUB_USER }}
178+
password: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
179+
164180
- name: Build
165181
if: env.dev_changed == 'true' || env.src_changed == 'true'
166182
shell: bash --noprofile --norc -eo pipefail {0}

.github/workflows/merge.pr.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ jobs:
3131
name: Build devel main image
3232
uses: ./.github/workflows/build-and-push-image.yml
3333
secrets:
34+
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
35+
GPUCIBOT_DOCKERHUB_TOKEN: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
3436
SCCACHE_GH_PAT: ${{ secrets.SCCACHE_GH_PAT }}
3537
strategy:
3638
fail-fast: true
@@ -52,6 +54,8 @@ jobs:
5254
- build-and-publish-devel-main-image
5355
uses: ./.github/workflows/build-and-push-image.yml
5456
secrets:
57+
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
58+
GPUCIBOT_DOCKERHUB_TOKEN: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
5559
SCCACHE_GH_PAT: ${{ secrets.SCCACHE_GH_PAT }}
5660
strategy:
5761
fail-fast: true
@@ -76,6 +80,8 @@ jobs:
7680
- build-and-publish-devel-main-image
7781
uses: ./.github/workflows/build-and-push-image.yml
7882
secrets:
83+
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
84+
GPUCIBOT_DOCKERHUB_TOKEN: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
7985
SCCACHE_GH_PAT: ${{ secrets.SCCACHE_GH_PAT }}
8086
strategy:
8187
fail-fast: true
@@ -97,6 +103,8 @@ jobs:
97103
- build-and-publish-runtime-cuda-base-image
98104
uses: ./.github/workflows/build-and-push-image.yml
99105
secrets:
106+
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
107+
GPUCIBOT_DOCKERHUB_TOKEN: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
100108
SCCACHE_GH_PAT: ${{ secrets.SCCACHE_GH_PAT }}
101109
strategy:
102110
fail-fast: true
@@ -121,6 +129,8 @@ jobs:
121129
- build-and-publish-runtime-cuda-base-image
122130
uses: ./.github/workflows/build-and-push-image.yml
123131
secrets:
132+
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
133+
GPUCIBOT_DOCKERHUB_TOKEN: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
124134
SCCACHE_GH_PAT: ${{ secrets.SCCACHE_GH_PAT }}
125135
strategy:
126136
fail-fast: true
@@ -145,6 +155,8 @@ jobs:
145155
- build-and-publish-runtime-cuda-base-image
146156
uses: ./.github/workflows/build-and-push-image.yml
147157
secrets:
158+
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
159+
GPUCIBOT_DOCKERHUB_TOKEN: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
148160
SCCACHE_GH_PAT: ${{ secrets.SCCACHE_GH_PAT }}
149161
strategy:
150162
fail-fast: true
@@ -169,6 +181,8 @@ jobs:
169181
- build-and-publish-runtime-cuda-base-image
170182
uses: ./.github/workflows/build-and-push-image.yml
171183
secrets:
184+
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
185+
GPUCIBOT_DOCKERHUB_TOKEN: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
172186
SCCACHE_GH_PAT: ${{ secrets.SCCACHE_GH_PAT }}
173187
strategy:
174188
fail-fast: true
@@ -193,6 +207,8 @@ jobs:
193207
- build-and-publish-runtime-cuda-base-image
194208
uses: ./.github/workflows/build-and-push-image.yml
195209
secrets:
210+
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
211+
GPUCIBOT_DOCKERHUB_TOKEN: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
196212
SCCACHE_GH_PAT: ${{ secrets.SCCACHE_GH_PAT }}
197213
strategy:
198214
fail-fast: true
@@ -217,6 +233,8 @@ jobs:
217233
- build-and-publish-runtime-cuda-base-image
218234
uses: ./.github/workflows/build-and-push-image.yml
219235
secrets:
236+
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
237+
GPUCIBOT_DOCKERHUB_TOKEN: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
220238
SCCACHE_GH_PAT: ${{ secrets.SCCACHE_GH_PAT }}
221239
strategy:
222240
fail-fast: true
@@ -243,6 +261,8 @@ jobs:
243261
- build-and-publish-runtime-cuda-base-image
244262
uses: ./.github/workflows/build-and-push-image.yml
245263
secrets:
264+
GPUCIBOT_DOCKERHUB_USER: ${{ secrets.GPUCIBOT_DOCKERHUB_USER }}
265+
GPUCIBOT_DOCKERHUB_TOKEN: ${{ secrets.GPUCIBOT_DOCKERHUB_TOKEN }}
246266
SCCACHE_GH_PAT: ${{ secrets.SCCACHE_GH_PAT }}
247267
strategy:
248268
fail-fast: true

0 commit comments

Comments
 (0)