-
Notifications
You must be signed in to change notification settings - Fork 41
55 lines (48 loc) · 1.57 KB
/
release_branch.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: GovCMS Release Branch Check
on:
push:
branches: 'release/**'
permissions:
contents: read
jobs:
check-branch-name:
runs-on: ubuntu-latest
steps:
- name: Check release branch name format
run: |
echo "Current branch is ${GITHUB_REF}"
REGEX="^refs/heads/release/([0-9]+)\.x/([0-9]+)\.[0-9]+\.[0-9]+$"
if [[ "$GITHUB_REF" =~ $REGEX ]]; then
major_ver=${BASH_REMATCH[1]}
rep_major_ver=${BASH_REMATCH[2]}
if [[ "$major_ver" == "$rep_major_ver" ]]; then
echo "Correct release branch name format"
else
echo "Incorrect release branch name format"
exit 1
fi
else
echo "Incorrect release branch name format"
exit 1
fi
check-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get GovCMS version
id: getGovcmsVersion
uses: mikefarah/yq@master
with:
cmd: yq '.version' 'govcms.info.yml'
- name: Check branch and govcms version are equal
run: |
G_VERSION=${{ steps.getGovcmsVersion.outputs.result }}
echo "GovCMS version defined as ${G_VERSION}"
echo "Current branch is ${GITHUB_REF}"
B_VERSION=$(echo $GITHUB_REF | cut -d '/' -f 5)
echo "Branch version is set to ${B_VERSION}"
if [ "$G_VERSION" != "$B_VERSION" ]; then
echo "GovCMS and Branch versions are not equal."
exit 1
fi