Update Docker login conditions and tag handling
This commit is contained in:
22
.github/workflows/docker-image.yml
vendored
22
.github/workflows/docker-image.yml
vendored
@@ -55,7 +55,7 @@ jobs:
|
|||||||
${{ runner.os }}-buildx-
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
if: ${{ github.event.inputs.registry != 'dockerhub' }}
|
if: ${{ github.event.inputs.registry == 'ghcr' || github.event.inputs.registry == 'both' }}
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
@@ -63,17 +63,15 @@ jobs:
|
|||||||
password: ${{ secrets.GHCR_TOKEN }}
|
password: ${{ secrets.GHCR_TOKEN }}
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
if: ${{ github.event.inputs.registry != 'ghcr' }}
|
if: ${{ github.event.inputs.registry == 'dockerhub' || github.event.inputs.registry == 'both' }}
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
username: bugattiguy527
|
username: bugattiguy527
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Determine Docker image tag(s)
|
- name: Determine Docker image tags
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
REPO_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]')
|
|
||||||
echo "REPO_OWNER=$REPO_OWNER" >> $GITHUB_ENV
|
|
||||||
if [ "${{ github.event.inputs.tag_name }}" != "" ]; then
|
if [ "${{ github.event.inputs.tag_name }}" != "" ]; then
|
||||||
IFS=',' read -ra RAW_TAGS <<< "${{ github.event.inputs.tag_name }}"
|
IFS=',' read -ra RAW_TAGS <<< "${{ github.event.inputs.tag_name }}"
|
||||||
TAGS=()
|
TAGS=()
|
||||||
@@ -90,19 +88,19 @@ jobs:
|
|||||||
else
|
else
|
||||||
TAGS=("${{ github.ref_name }}")
|
TAGS=("${{ github.ref_name }}")
|
||||||
fi
|
fi
|
||||||
echo "TAGS=${TAGS[*]}" >> $GITHUB_ENV
|
|
||||||
echo "ALL_TAGS<<EOF" >> $GITHUB_ENV
|
TAG_STR=""
|
||||||
for tag in "${TAGS[@]}"; do
|
for tag in "${TAGS[@]}"; do
|
||||||
if [ "${{ github.event.inputs.registry }}" == "ghcr" ]; then
|
if [ "${{ github.event.inputs.registry }}" == "ghcr" ]; then
|
||||||
echo "ghcr.io/lukegus/termix:${tag}"
|
TAG_STR+="ghcr.io/lukegus/termix:${tag} "
|
||||||
elif [ "${{ github.event.inputs.registry }}" == "dockerhub" ]; then
|
elif [ "${{ github.event.inputs.registry }}" == "dockerhub" ]; then
|
||||||
echo "docker.io/bugattiguy527/termix:${tag}"
|
TAG_STR+="docker.io/bugattiguy527/termix:${tag} "
|
||||||
else
|
else
|
||||||
echo "ghcr.io/lukegus/termix:${tag}"
|
TAG_STR+="ghcr.io/lukegus/termix:${tag} docker.io/bugattiguy527/termix:${tag} "
|
||||||
echo "docker.io/bugattiguy527/termix:${tag}"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "EOF" >> $GITHUB_ENV
|
echo "ALL_TAGS=$TAG_STR" >> $GITHUB_ENV
|
||||||
|
echo "TAGS: $TAG_STR"
|
||||||
|
|
||||||
- name: Build and Push Multi-Arch Docker Image
|
- name: Build and Push Multi-Arch Docker Image
|
||||||
uses: useblacksmith/build-push-action@v2
|
uses: useblacksmith/build-push-action@v2
|
||||||
|
|||||||
Reference in New Issue
Block a user