Skip to content

Commit 1ec5349

Browse files
authored
[GHA] Validate API and SDK version in server release (temporalio#7675)
1 parent d95790e commit 1ec5349

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/create-tag.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ on:
99
tag:
1010
description: "Tag for new version (1.23.4)"
1111
required: true
12+
skip_deps_check:
13+
type: boolean
14+
description: "Skip dependencies version check (you can skip only when creating non-release tags)"
15+
default: false
1216
release_notes:
1317
type: boolean
1418
description: "Create draft release notes"
@@ -73,6 +77,35 @@ jobs:
7377
echo "tag_no_v=${TAG}" >> "$GITHUB_OUTPUT"
7478
fi
7579
80+
- name: Validate API and SDK dependencies
81+
env:
82+
SKIP_CHECK: ${{ github.event.inputs.skip_deps_check }}
83+
TAG: ${{ steps.new_version.outputs.tag_with_v }}
84+
run: |
85+
SEMVER_RE='^v[0-9]+\.[0-9]+\.[0-9]+$'
86+
87+
if [[ "$SKIP_CHECK" == "true" ]]; then
88+
if [[ ! "$TAG" =~ $SEMVER_RE ]]; then
89+
echo "::notice::Skipping dependencies check"
90+
exit 0
91+
fi
92+
echo "::warning::Cannot skip dependencies check when creating a potential release tag $TAG"
93+
fi
94+
95+
MODULES=( "go.temporal.io/api" "go.temporal.io/sdk" )
96+
for module in "${MODULES[@]}"; do
97+
version=$(go list -f '{{.Version}}' -m "$module")
98+
if [[ ! "$version" =~ $SEMVER_RE ]]; then
99+
echo "::error::Using non-tagged version of module $module with version $version"
100+
exit 1
101+
fi
102+
replace=$(go list -f '{{.Replace}}' -m "$module")
103+
if [[ "$replace" != "<nil>" ]]; then
104+
echo "::error::Module $module is replaced with $replace"
105+
exit 1
106+
fi
107+
done
108+
76109
- name: Update Server version
77110
if: ${{ steps.get_current_version.outputs.CURRENT_VERSION != github.event.inputs.tag }}
78111
env:

0 commit comments

Comments
 (0)