Skip to content

Commit e0548a0

Browse files
committed
feat: add release channel tag to image
Signed-off-by: Zoupers <qy@zouper.cn>
1 parent 60c4944 commit e0548a0

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

.github/workflows/release.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,11 @@ jobs:
497497
else
498498
echo "created_latest_tag=false" >> $GITHUB_OUTPUT
499499
fi
500+
# push image based on current channel
501+
./scripts/build_docker_multiarch.sh \
502+
--push \
503+
--target "$(./scripts/image_tag.sh --channel ${CODER_RELEASE_CHANNEL})" \
504+
$(cat build/coder_"$version"_linux_{amd64,arm64,armv7}.tag)
500505
env:
501506
CODER_BASE_IMAGE_TAG: ${{ steps.image-base-tag.outputs.tag }}
502507

scripts/image_tag.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
# If no version is specified, defaults to the version from ./version.sh. If the
1212
# supplied version is "latest", no `v` prefix will be added to the tag.
1313
#
14+
# The --channel parameter indecates the specific release channel, it's conflicts
15+
# with --version parameter.
16+
#
1417
# The returned tag will be sanitized to remove invalid characters like the plus
1518
# sign.
1619

@@ -20,8 +23,9 @@ source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
2023

2124
arch=""
2225
version=""
26+
channel=""
2327

24-
args="$(getopt -o "" -l arch:,version: -- "$@")"
28+
args="$(getopt -o "" -l arch:,version:,channel: -- "$@")"
2529
eval set -- "$args"
2630
while true; do
2731
case "$1" in
@@ -33,6 +37,10 @@ while true; do
3337
version="$2"
3438
shift 2
3539
;;
40+
--channel)
41+
channel="$2"
42+
shift 2
43+
;;
3644
--)
3745
shift
3846
break
@@ -45,7 +53,7 @@ done
4553

4654
# Remove the "v" prefix because we don't want to add it twice.
4755
version="${version#v}"
48-
if [[ "$version" == "" ]]; then
56+
if [[ "$version" == "" ]] && [[ "$channel" == "" ]]; then
4957
version="$(execrelative ./version.sh)"
5058
fi
5159

@@ -60,6 +68,10 @@ if [[ "$version" == "latest" ]]; then
6068
tag="latest"
6169
fi
6270

71+
if [[ "$channel" != "" ]]; then
72+
tag="$channel"
73+
fi
74+
6375
if [[ "$arch" != "" ]]; then
6476
tag+="-$arch"
6577
fi

0 commit comments

Comments
 (0)