Skip to content

Commit dc4707c

Browse files
committed
Add support for v2 tag version
1 parent 1f857d6 commit dc4707c

File tree

3 files changed

+33
-5
lines changed

3 files changed

+33
-5
lines changed

app-deploy.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ source /usr/local/bin/.app-deploy-sources/__deploy_tags.sh
1313
# Script used for creating the specific #
1414
# tag used for triggering the CI deployment #
1515
# #
16-
# End tag should look like this: #
17-
# internal-all/v1.0.0-1234 #
1816
# #
1917
# Prepared by Jasmin Abou Aldan #
20-
# Copyright (c) 2020 Infinum. All rights reserved. #
18+
# Copyright (c) 2024 Infinum. All rights reserved. #
2119
###############################################################
2220

2321
# Use global variables at your own risk as this can be overridden in the future.
@@ -45,7 +43,12 @@ function main {
4543

4644
deploy_options # Get from .deploy-options.sh, setup per project
4745
__input_to_tags
48-
__create_app_version_and_build_number
46+
47+
if [ -z "$script_version" ] || [ "$script_version" == "v1" ]; then
48+
__create_app_version_and_build_number
49+
elif [ "$script_version" == "v2" ]; then
50+
__create_trigger_ci_timestamp_tag
51+
fi
4952

5053
# CREATE CHANGELOG
5154

sources/__base_tag_handling.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ function __input_to_tags {
2020
}
2121

2222
# Generate app version and build number
23+
# Used in v1 version of the script
2324
function __create_app_version_and_build_number {
2425

2526
echo
@@ -68,6 +69,28 @@ function __create_app_version_and_build_number {
6869
sleep 1
6970
}
7071

72+
# Generate trigger tag with timestamp
73+
# Used in v2 version of the script
74+
function __create_trigger_ci_timestamp_tag {
75+
76+
# Create tag name ci/{environment}/{timestamp}}. E.g. ci/internal-staging/2024-12-05T17-16-28
77+
tags_to_deploy=()
78+
79+
# Prefix ci
80+
trigger_tag="ci/"
81+
82+
# Environments
83+
for target in "${environments_to_build[@]}"; do
84+
trigger_tag+="$target/"
85+
done
86+
87+
# Sufix timestamp
88+
trigger_tag+="$(date +%Y-%m-%dT%H-%M-%S)"
89+
90+
# Assign to shared property
91+
tags_to_deploy=("$trigger_tag")
92+
}
93+
7194
# Changelog
7295
function __generate_tag_and_changelog {
7396

sources/__deploy_tags.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ function __push_tag_and_start_deploy {
1818
echo "---------------------------------------------------------------"
1919
echo " ~ CONFIGURATION ~ "
2020
echo
21-
echo "Version: ${bold}v$appversion-$tags_count${normal}"
21+
if [ -n "$appversion" ]; then
22+
echo "Version: ${bold}v$appversion-$tags_count${normal}"
23+
fi
2224
for tag in "${tags_to_deploy[@]}"; do
2325
echo "Tag: ${bold}$tag${normal}"
2426
done

0 commit comments

Comments
 (0)