Docker: username not secret; allow cache pulls
This commit is contained in:
4
.github/scripts/docker-build.bash
vendored
4
.github/scripts/docker-build.bash
vendored
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
set -ex
|
||||
set -e
|
||||
|
||||
DH_USERNAME="${DOCKERHUB_USERNAME:-conky}"
|
||||
DOCKERHUB_IMAGE_ID=$DH_USERNAME/$IMAGE_NAME
|
||||
@@ -37,7 +37,7 @@ if [[ "$GITHUB_REF" == refs/heads/main ]]; then
|
||||
fi
|
||||
|
||||
# Only write to cache if credentials are available
|
||||
if [[ -z "$DOCKERHUB_USERNAME" ]]; then
|
||||
if [[ -z "$DOCKERHUB_TOKEN" ]]; then
|
||||
write_cache=""
|
||||
else
|
||||
write_cache="--cache-to=type=registry,ref=$DOCKERHUB_IMAGE_ID:$cache_tag,mode=max"
|
||||
|
7
.github/workflows/docker.yaml
vendored
7
.github/workflows/docker.yaml
vendored
@@ -28,7 +28,8 @@ jobs:
|
||||
env:
|
||||
IMAGE_NAME: conky
|
||||
DOCKER_BUILDKIT: 1
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_USERNAME: brndnmtthws
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -40,7 +41,7 @@ jobs:
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
if: ${{ env.DOCKERHUB_USERNAME != '' }}
|
||||
if: ${{ env.DOCKERHUB_TOKEN != '' }}
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
@@ -48,4 +49,4 @@ jobs:
|
||||
env:
|
||||
RELEASE: "${{ startsWith(github.ref, 'refs/tags/') && 'ON' || 'OFF' }}"
|
||||
GITHUB_REF: ${{ github.ref }}
|
||||
run: ./.github/scripts/docker-build.bash
|
||||
run: .github/scripts/docker-build.bash
|
||||
|
Reference in New Issue
Block a user