-
Notifications
You must be signed in to change notification settings - Fork 8
55 lines (51 loc) · 1.74 KB
/
Copy pathrelease-version-check.yml
File metadata and controls
55 lines (51 loc) · 1.74 KB
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: Branch Protection
on:
pull_request:
types: [opened, edited, synchronize]
branches:
- master
- develop
permissions:
contents: read
jobs:
check-rc-pattern:
runs-on: ubuntu-latest
if: startsWith(github.head_ref, 'release/')
steps:
- name: Check RC pattern
env:
HEAD_REF: ${{ github.head_ref }}
run: |
if [[ "$HEAD_REF" =~ release/[0-9]+\.[0-9]+\.[0-9]+-rc ]]; then
echo "Branch name contains release/version-rc pattern. Merging is not allowed. Only stable release should be merge into master"
exit 1
fi
check-master-version:
needs: check-rc-pattern
runs-on: ubuntu-latest
if: github.base_ref == 'master' && startsWith(github.head_ref, 'release/')
steps:
- name: Checkout master branch
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: master
path: master
- name: Checkout release branch
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
ref: ${{ github.head_ref }}
path: release
- name: Extract versions
run: |
MASTER_VERSION=$(grep 'version:' master/mindbox/pubspec.yaml | awk '{print $2}')
RELEASE_VERSION=$(grep 'version:' release/mindbox/pubspec.yaml | awk '{print $2}')
{
echo "MASTER_VERSION=$MASTER_VERSION"
echo "RELEASE_VERSION=$RELEASE_VERSION"
} >> "$GITHUB_ENV"
- name: Compare versions
uses: jackbilestech/semver-compare@b6b063c569b77bea4a0ab627192cbdabf75de3f5 # 1.0.4
with:
head: ${{ env.RELEASE_VERSION }}
base: ${{ env.MASTER_VERSION }}
operator: '>'