Skip to content

Commit 9c32217

Browse files
committed
Merge branch 'master' into 2022.3
2 parents 145c6f2 + 0cf2bed commit 9c32217

File tree

2 files changed

+43
-12
lines changed

2 files changed

+43
-12
lines changed

.github/scripts/add-tags.sh

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,14 @@
33
# example usage
44
# sh add-tags.sh "6000.0.0f1" -> Creates tags for non-urp version
55
# sh add-tags.sh "6000.0.0f1" "true" -> Creates tags for urp version
6+
# sh add-tags.sh "6000.0.0f1" "true" "10" -> Creates tags for urp version with 10 second delay between pushes
67

78
# Input parameters
89
UNITY_VERSION=$1
910
IS_URP=${2:-"false"}
10-
echo "Running add_tags.sh with UNITY_VERSION: $UNITY_VERSION, IS_URP: $IS_URP"
11+
DELAY_TAGS=${3:-"0"}
12+
13+
echo "Running add_tags.sh with UNITY_VERSION: $UNITY_VERSION, IS_URP: $IS_URP, DELAY_TAGS: $DELAY_TAGS seconds"
1114

1215
# Extract the value before the first dot as an integer
1316
MAJOR_VERSION=$(echo $UNITY_VERSION | cut -d. -f1)
@@ -19,22 +22,42 @@ then
1922
TAG_PREFIX=$UNITY_VERSION-urp
2023
fi
2124

25+
# Build array of tags to create and push
26+
TAGS=()
27+
2228
if [[ "$MAJOR_VERSION" -lt "2023" ]]
2329
then
24-
git tag -a -f $TAG_PREFIX-minsize-webgl1 -m "[Automated workflow] Created by upgrade-unity"
25-
git tag -a -f $TAG_PREFIX-webgl1 -m "[Automated workflow] Created by upgrade-unity"
30+
TAGS+=("$TAG_PREFIX-minsize-webgl1")
31+
TAGS+=("$TAG_PREFIX-webgl1")
2632
else
27-
git tag -a -f $TAG_PREFIX-minsize-webgl2 -m "[Automated workflow] Created by upgrade-unity"
33+
TAGS+=("$TAG_PREFIX-minsize-webgl2")
2834
fi
29-
# Push tags in between - pushing more than 3 tags won't trigger tag workflows
30-
git push origin -f --tags
3135

32-
git tag -a -f $TAG_PREFIX-webgl2 -m "[Automated workflow] Created by upgrade-unity"
33-
git tag -a -f $TAG_PREFIX-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
36+
TAGS+=("$TAG_PREFIX-webgl2")
37+
TAGS+=("$TAG_PREFIX-webgl2-debug")
3438

3539
if [[ "$MAJOR_VERSION" -ge "6000" ]]
3640
then
37-
git tag -a -f $TAG_PREFIX-webgpu -m "[Automated workflow] Created by upgrade-unity"
41+
TAGS+=("$TAG_PREFIX-webgpu")
3842
fi
3943

40-
git push origin -f --tags
44+
# Loop through tags, create and push each one with delay
45+
for i in "${!TAGS[@]}"; do
46+
TAG="${TAGS[$i]}"
47+
echo "Creating and pushing tag: $TAG"
48+
49+
# Create the tag
50+
git tag -a -f "$TAG" -m "[Automated workflow] Created by upgrade-unity"
51+
52+
# Push the tag
53+
git push origin -f "$TAG"
54+
55+
# Wait between pushes if not the last tag and delay is specified
56+
if [[ $i -lt $((${#TAGS[@]} - 1)) ]] && [[ "$DELAY_TAGS" -gt "0" ]]
57+
then
58+
echo "Waiting $DELAY_TAGS seconds before next tag push..."
59+
sleep $DELAY_TAGS
60+
fi
61+
done
62+
63+
echo "All tags created and pushed successfully."

.github/workflows/upgrade-unity.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ on:
2929
required: false
3030
type: string
3131
default: '-accept-apiupdate'
32+
delayTags:
33+
description: 'Delay between tag pushes (in seconds, minimum 1)'
34+
required: false
35+
type: number
36+
default: 1
3237

3338
jobs:
3439
upgrade-unity-version:
@@ -45,6 +50,7 @@ jobs:
4550
echo "Only create tags: $TAGS_ONLY"
4651
echo "Merge master into branch: $MERGE_MASTER"
4752
echo "Custom cli arguments: $CUSTOM_PARAMETERS"
53+
echo "Delay tags: $DELAY_TAGS seconds"
4854
if [[ "$BRANCH_NAME" == *"urp"* ]]
4955
then
5056
echo "urp: true"
@@ -57,6 +63,7 @@ jobs:
5763
TAGS_ONLY: ${{ inputs.tagsOnly }}
5864
MERGE_MASTER: ${{ inputs.mergeMaster }}
5965
CUSTOM_PARAMETERS: ${{ inputs.customParameters }}
66+
DELAY_TAGS: ${{ inputs.delayTags }}
6067

6168
- uses: actions/checkout@v4
6269
with:
@@ -205,8 +212,9 @@ jobs:
205212
IS_URP=true
206213
fi
207214
208-
# Run add tags script
209-
./.github/scripts/add-tags.sh "$UNITY_VERSION" "$IS_URP"
215+
# Run add tags script with delay parameter
216+
./.github/scripts/add-tags.sh "$UNITY_VERSION" "$IS_URP" "$DELAY_TAGS"
210217
env:
211218
UNITY_VERSION: ${{ inputs.unityVersion }}
219+
DELAY_TAGS: ${{ inputs.delayTags }}
212220

0 commit comments

Comments
 (0)