Skip to content

Commit 218910b

Browse files
committed
Add version check in CI
1 parent 02c604f commit 218910b

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

.circleci/config.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,16 @@ workflows:
3838
branches:
3939
only:
4040
- "master"
41-
- '/^v\d+\.\d+\.x/'
41+
- '/^v\d+\.\d+\.x/' # E.g. v4.13.x
42+
43+
release:
44+
jobs:
45+
- check_version:
46+
filters: # Only runs on tag such as v3.0.23
47+
branches:
48+
ignore: '/.*/'
49+
tags:
50+
only: '/^v\d+\.\d+\.\d+/'
4251

4352

4453
# Execute a set of commands in a clean image
@@ -131,6 +140,21 @@ jobs:
131140
git_email: "BotEcole@users.noreply.github.com"
132141
ssh_fingerprints: "a9:13:fc:02:79:6c:60:8a:72:b1:c3:87:6c:5e:06:32"
133142

143+
check_version:
144+
docker:
145+
- image: "cimg/base:2020.12"
146+
auth: *dockerhub_auth
147+
steps:
148+
- checkout
149+
- run:
150+
name: "Verifiying version file matches tag"
151+
command: |
152+
for part in 1 2 3 ; do
153+
tag_part="$( echo $CIRCLE_TAG | sed s/v// | cut -d '.' -f $part )"
154+
file_part="$( sed $part'q;d' VERSION | cut -d ' ' -f 2 )"
155+
[ $tag_part -eq $file_part ]
156+
done
157+
134158
135159
# Reusable set of instructions to be used in jobs
136160
commands:

0 commit comments

Comments
 (0)