ci: only run dockerhub steps if username and token are not empty
Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
parent
95ca7bc3e4
commit
ed5be58f9f
1 changed files with 7 additions and 3 deletions
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
|
@ -19,7 +19,6 @@ env:
|
|||
# Custom nix binary cache if fork is being used
|
||||
ATTIC_ENDPOINT: ${{ vars.ATTIC_ENDPOINT }}
|
||||
ATTIC_PUBLIC_KEY: ${{ vars.ATTIC_PUBLIC_KEY }}
|
||||
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }}
|
||||
|
||||
permissions:
|
||||
packages: write
|
||||
|
@ -182,7 +181,10 @@ jobs:
|
|||
|
||||
|
||||
- name: Login to Dockerhub
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }}
|
||||
if: ${{ (github.event_name != 'pull_request') || ((env.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '')) }}
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
# username is not really a secret
|
||||
|
@ -201,11 +203,13 @@ jobs:
|
|||
|
||||
|
||||
- name: Publish to Dockerhub
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }}
|
||||
IMAGE_NAME: docker.io/${{ github.repository }}
|
||||
IMAGE_SUFFIX_AMD64: amd64
|
||||
IMAGE_SUFFIX_ARM64V8: arm64v8
|
||||
if: ${{ (github.event_name != 'pull_request') || ((env.DOCKER_USERNAME != '') && (env.DOCKERHUB_TOKEN != '')) }}
|
||||
run: |
|
||||
docker load -i oci-image-amd64.tar.gz
|
||||
IMAGE_ID_AMD64=$(docker images -q conduit:main)
|
||||
|
|
Loading…
Add table
Reference in a new issue