workflows/docker: only perform login when necessary

This commit is contained in:
Ruoyu Zhong 2024-08-27 11:16:26 +08:00
parent 81d26f8059
commit ae2b3bc7d4
No known key found for this signature in database

View File

@ -53,7 +53,8 @@ jobs:
- name: Log in to GitHub Packages - name: Log in to GitHub Packages
if: > if: >
github.event_name == 'release' || github.event_name == 'release' ||
(github.event_name == 'push' && github.ref == 'refs/heads/master') (github.event_name == 'push' && github.ref == 'refs/heads/master' &&
matrix.version == '22.04')
run: | run: |
docker login ghcr.io -u BrewTestBot --password-stdin <<<"$TOKEN" docker login ghcr.io -u BrewTestBot --password-stdin <<<"$TOKEN"
env: env:
@ -62,7 +63,8 @@ jobs:
- name: Log in to Docker Hub - name: Log in to Docker Hub
if: > if: >
github.event_name == 'release' || github.event_name == 'release' ||
(github.event_name == 'push' && github.ref == 'refs/heads/master') (github.event_name == 'push' && github.ref == 'refs/heads/master' &&
matrix.version == '22.04')
run: | run: |
docker login -u brewtestbot --password-stdin <<<"$TOKEN" docker login -u brewtestbot --password-stdin <<<"$TOKEN"
env: env: