Skip to content

Commit 033256b

Browse files
authored
Add metadata.yaml validation before release (#1221)
Signed-off-by: apedriza <[email protected]>
1 parent d8835b2 commit 033256b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,34 @@ on:
66
- v* # Push events to matching v*, i.e. v1.0, v20.15.10
77

88
jobs:
9+
# Check if the tag mayor/minor is in the metadata.yaml file
10+
check-tag:
11+
name: Check tag
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Download yq
15+
uses: supplypike/setup-bin@v4
16+
with:
17+
name: yq
18+
version: v4.30.6
19+
uri: https://github.com/mikefarah/yq/releases/download/v4.30.6/yq_linux_amd64
20+
21+
- name: Check that metadata.yaml includes tag version
22+
id: get_major_minor
23+
run: |
24+
TAG="${GITHUB_REF#refs/tags/}"
25+
TAG="${TAG#v}"
26+
IFS='.' read -r major minor patch <<< "$TAG"
27+
major_minor="$major.$minor"
28+
29+
all_versions=$(yq -r '.releaseSeries[] | "\(.major).\(.minor)"' metadata.yaml)
30+
31+
if ! echo "$all_versions" | grep -q "^$major_minor$"; then
32+
echo "metadata.yaml does not include version '$major_minor'"
33+
echo "Found versions:"
34+
echo "$all_versions"
35+
exit 1
36+
fi
937
release:
1038
name: release
1139
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)