Skip to content

Commit b8909e6

Browse files
committed
Check status of dockerhub step
1 parent c6d96e0 commit b8909e6

1 file changed

Lines changed: 8 additions & 16 deletions

File tree

.github/workflows/docker.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,10 @@ jobs:
5757
type=semver,pattern={{major}}
5858
type=sha
5959
60-
- name: Check DockerHub permissions
61-
id: dockerhub
62-
shell: bash
63-
run: |
64-
if [ -z $"{{ secrets.DOCKERHUB_TOKEN }}" ]; then
65-
echo "dockerhub=false" >> $GITHUB_OUTPUT
66-
else
67-
echo "dockerhub=true" >> $GITHUB_OUTPUT
68-
fi
69-
7060
- name: Login to DockerHub
71-
if: steps.dockerhub.outputs.dockerhub == 'true'
61+
id: dockerhub
7262
uses: docker/login-action@v4
63+
continue-on-error: true
7364
with:
7465
username: ${{ github.repository_owner }}
7566
password: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -83,7 +74,7 @@ jobs:
8374
password: ${{ secrets.GITHUB_TOKEN }}
8475

8576
- name: Build and push by digest (DockerHub)
86-
if: github.event_name != 'pull_request' && steps.dockerhub.outputs.dockerhub == 'true'
77+
if: github.event_name != 'pull_request' && steps.dockerhub.outcome != 'failure'
8778
uses: docker/build-push-action@v7
8879
id: build-dockerhub
8980
with:
@@ -105,7 +96,7 @@ jobs:
10596
if: github.event_name != 'pull_request'
10697
run: |
10798
mkdir -p /tmp/digests
108-
if [ steps.dockerhub.outputs.dockerhub == 'true' ]; then
99+
if [ steps.dockerhub.outcome != 'failure' ]; then
109100
digest="${{ steps.build-dockerhub.outputs.digest }}"
110101
echo "${digest#sha256:}" > /tmp/digests/dockerhub-digest
111102
fi
@@ -155,8 +146,9 @@ jobs:
155146
type=sha
156147
157148
- name: Login to DockerHub
158-
if: steps.dockerhub.outputs.dockerhub == 'true'
149+
id: dockerhub
159150
uses: docker/login-action@v4
151+
continue-on-error: true
160152
with:
161153
username: ${{ github.repository_owner }}
162154
password: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -169,7 +161,7 @@ jobs:
169161
password: ${{ secrets.GITHUB_TOKEN }}
170162

171163
- name: Create and push merged image (DockerHub)
172-
if: steps.dockerhub.outputs.dockerhub == 'true'
164+
if: steps.dockerhub.outcome != 'failure'
173165
working-directory: /tmp/digests
174166
run: |
175167
# Extract all Docker image tags from the Docker metadata JSON, prepend each with "-t " (required by buildx), and convert them into a single space-separated string
@@ -187,7 +179,7 @@ jobs:
187179
188180
- name: Inspect Docker images
189181
run: |
190-
if [ steps.dockerhub.outputs.dockerhub == 'true' ]; then
182+
if [ steps.dockerhub.outcome != 'failure' ]; then
191183
docker buildx imagetools inspect "jonchang/tact:${{ steps.meta.outputs.version }}"
192184
fi
193185
docker buildx imagetools inspect "ghcr.io/jonchang/tact:${{ steps.meta.outputs.version }}"

0 commit comments

Comments
 (0)