Skip to content

Commit 1347d6f

Browse files
committed
Move tagging script out of workflow into its own script
1 parent 844a167 commit 1347d6f

File tree

2 files changed

+43
-25
lines changed

2 files changed

+43
-25
lines changed

.github/scripts/add-tags.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/bash
2+
# This script creates tags for the given unity version to trigger the release workflow
3+
# example usage
4+
# sh add-tags.sh "6000.0.0f1" -> Creates tags for non-urp version
5+
# sh add-tags.sh "6000.0.0f1" "true" -> Creates tags for urp version
6+
7+
# Input parameters
8+
UNITY_VERSION=$1
9+
IS_URP=${2:-"false"}
10+
11+
# Extract the first four characters of UNITY_VERSION
12+
MAJOR_VERSION=${UNITY_VERSION:0:4}
13+
BRANCH_NAME=${GITHUB_REF#refs/heads/}
14+
15+
TAG_PREFIX=$UNITY_VERSION
16+
if [[ "$IS_URP" == "true" ]]
17+
then
18+
TAG_PREFIX=$UNITY_VERSION-urp
19+
fi
20+
21+
if [[ "$MAJOR_VERSION" -lt "2023" ]]
22+
then
23+
git tag -a -f $TAG_PREFIX-minsize-webgl1 -m "[Automated workflow] Created by upgrade-unity"
24+
git tag -a -f $TAG_PREFIX-webgl1 -m "[Automated workflow] Created by upgrade-unity"
25+
else
26+
git tag -a -f $TAG_PREFIX-minsize-webgl2 -m "[Automated workflow] Created by upgrade-unity"
27+
fi
28+
# Push tags in between - pushing more than 3 tags won't trigger tag workflows
29+
git push origin -f --tags
30+
31+
git tag -a -f $TAG_PREFIX-webgl2 -m "[Automated workflow] Created by upgrade-unity"
32+
git tag -a -f $TAG_PREFIX-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
33+
34+
if [[ "$MAJOR_VERSION" -ge "6000" ]]
35+
then
36+
git tag -a -f $TAG_PREFIX-webgpu -m "[Automated workflow] Created by upgrade-unity"
37+
fi
38+
39+
git push origin -f --tags

.github/workflows/upgrade-unity.yml

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -168,35 +168,14 @@ jobs:
168168
- name: Add tags
169169
if: ${{ inputs.createTags || inputs.tagsOnly }}
170170
run: |
171-
# Extract the first four characters of UNITY_VERSION
172-
MAJOR_VERSION=${UNITY_VERSION:0:4}
173171
BRANCH_NAME=${GITHUB_REF#refs/heads/}
174172
175-
TAG_PREFIX=$UNITY_VERSION
176-
if [[ "$BRANCH_NAME" == *"urp"* ]]
177-
then
178-
TAG_PREFIX=$UNITY_VERSION-urp
179-
fi
180-
181-
if [[ "$MAJOR_VERSION" < "2023" ]]
182-
then
183-
git tag -a -f $TAG_PREFIX-minsize-webgl1 -m "[Automated workflow] Created by upgrade-unity"
184-
git tag -a -f $TAG_PREFIX-webgl1 -m "[Automated workflow] Created by upgrade-unity"
185-
else
186-
git tag -a -f $TAG_PREFIX-minsize-webgl2 -m "[Automated workflow] Created by upgrade-unity"
187-
fi
188-
# Push tags in between - pushing more than 3 tags won't trigger tag workflows
189-
git push origin -f --tags
190-
191-
git tag -a -f $TAG_PREFIX-webgl2 -m "[Automated workflow] Created by upgrade-unity"
192-
git tag -a -f $TAG_PREFIX-webgl2-debug -m "[Automated workflow] Created by upgrade-unity"
193-
194-
if [[ "$MAJOR_VERSION" >= "6000" ]]
195-
then
196-
git tag -a -f $TAG_PREFIX-webgpu -m "[Automated workflow] Created by upgrade-unity"
173+
IS_URP=false
174+
if [[ "$BRANCH_NAME" == *"urp"* ]]; then
175+
IS_URP=true
197176
fi
198177
199-
git push origin -f --tags
178+
sh .github/scripts/add-tags.sh $UNITY_VERSION $IS_URP
200179
env:
201180
UNITY_VERSION: ${{ inputs.unityVersion }}
202181

0 commit comments

Comments
 (0)