Skip to content

Commit

Permalink
generate additional tag
Browse files Browse the repository at this point in the history
  • Loading branch information
AyodeAwe committed Sep 19, 2023
1 parent 7f9d049 commit d5a0fd6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/build-and-publish-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
uses: ./.github/workflows/build-image.yml
with:
ARCHES: ${{ toJSON(matrix.ARCHES) }}
BUILD_TYPE: ${{ inputs.build_type }}
CUDA_VER: ${{ matrix.CUDA_VER }}
LINUX_VER: ${{ matrix.LINUX_VER }}
PYTHON_VER: ${{ matrix.PYTHON_VER }}
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ on:
IMAGE_NAME:
required: true
type: string
build_type:
required: true
type: string

jobs:
run:
Expand Down Expand Up @@ -57,6 +60,12 @@ jobs:
LINUX_VER: ${{ inputs.LINUX_VER }}
PYTHON_VER: ${{ inputs.PYTHON_VER }}
ARCH: ${{ matrix.ARCH }}
- name: Generate Additional Tag
id: generate-additional-tag
run: ci/generate-tags.sh
env:
CURRENT_TAG: ${{ inputs.IMAGE_NAME }}-${{ matrix.ARCH }}
build_type: ${{ inputs.build_type}}
- name: Build image
uses: docker/build-push-action@v4
with:
Expand All @@ -66,4 +75,5 @@ jobs:
pull: true
build-args: |
${{ steps.generate-build-args.outputs.ARGS }}
tags: ${{ inputs.IMAGE_NAME }}-${{ matrix.ARCH }}
tags: |
${{ steps.generate-additional-tag.outputs.TAGS }}
18 changes: 18 additions & 0 deletions ci/generate-tags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

prefix=$(echo "$CURRENT_TAG" | awk -F':' '{print $1}')
suffix=$(echo "$CURRENT_TAG" | awk -F':' '{print $2}')

if [ "$build_type" == "branch" ]; then
cat <<EOF > "${GITHUB_OUTPUT:-/dev/stdout}"
TAGS<<EOT
$(printf "%s\n" "${prefix}:${suffix}" "${prefix}-conda:${suffix}")
EOT
EOF
else
cat <<EOF > "${GITHUB_OUTPUT:-/dev/stdout}"
TAGS<<EOT
$(printf "%s\n" "$CURRENT_TAG")
EOT
EOF
fi

0 comments on commit d5a0fd6

Please sign in to comment.