Merge pull request #96 from kevin-david/docker_username

Allow DockerHub username to be specified via `DOCKER_USERNAME` var
This commit is contained in:
Andrew King authored and GitHub committed 2023-06-01 15:20:00 +01:00
commit cf67a05dd1
2 files changed
+20 -5

No files matched your search

+18 -3
View File
@@ -195,8 +195,23 @@ jobs:
uses: docker/login-action@v2
with:
registry: docker.io
username: ${{ steps.string_user.outputs.lowercase }}
username: ${{ vars.DOCKER_USERNAME || steps.string_user.outputs.lowercase }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Set Docker name with owner (package name) depending on if DOCKER_USERNAME is set
if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }}
id: docker_repo
shell: bash
run: |
if [ -z $DOCKER_USERNAME ]; then
echo "DOCKER_NWO=${GITHUB_NWO}" >> $GITHUB_OUTPUT
else
IFS='/' read -ra NWO_SPLIT <<< "$GITHUB_NWO"
REPO_NAME=${NWO_SPLIT[1]}
echo "DOCKER_NWO=${DOCKER_USERNAME}/${REPO_NAME}" >> $GITHUB_OUTPUT
fi
env:
DOCKER_USERNAME: ${{ vars.DOCKER_USERNAME }}
GITHUB_NWO: ${{ steps.string_repo.outputs.lowercase }}
- name: Get tag name
if: ${{ steps.vars.outputs.HAS_SECRET_TOKEN }}
id: tags
@@ -226,7 +241,7 @@ jobs:
echo "TAGS=${tagstr}"
echo "TAGS=${tagstr}" >> "${GITHUB_OUTPUT}"
env:
REPO_NAME: ${{ steps.string_repo.outputs.lowercase }}
REPO_NAME: ${{ steps.docker_repo.outputs.DOCKER_NWO }}
- name: Install latest rust
run: |
rustup toolchain install stable
@@ -272,7 +287,7 @@ jobs:
push: true
file: Dockerfile
tags: ${{ steps.tags.outputs.TAGS }}
build-args: VERSION=${{ steps.toml.outputs.version }}, REPO=${{ github.repository }}, OWNER=${{ github.repository_owner }}
build-args: VERSION=${{ steps.toml.outputs.version }}, REPO=${{ github.repository }}, OWNER=${{ vars.DOCKER_USERNAME || github.repository_owner }}
env:
DOCKER_BUILDKIT: 1
+2 -2
View File
@@ -143,5 +143,5 @@ jobs:
env:
DAYS: "100"
REPO_NAME: ${{ steps.string_repo.outputs.lowercase }}
OWNER: ${{ steps.string_user.outputs.lowercase }}
TOKEN: ${{ secrets.DOCKER_PRUNE__TOKEN }}
OWNER: ${{ vars.DOCKER_USERNAME || steps.string_user.outputs.lowercase }}
TOKEN: ${{ secrets.DOCKER_PRUNE_TOKEN }}