-
Notifications
You must be signed in to change notification settings - Fork 1
40 lines (39 loc) · 1.38 KB
/
merge_requirements.yaml
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
name: Merge Requirements
on:
pull_request:
jobs:
check-version:
name: Ensure version bump
runs-on: ubuntu-latest
if: ${{ github.base_ref == 'v1' }}
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v18
with:
extra_nix_config: |
keep-derivations = true
keep-outputs = true
- run: nix-store --import < /tmp/nix-cache
if: "steps.nix-cache.outputs.cache-hit == 'true'"
- run: |
newVersion=$(npm -j list setup-captain | jq -r .version)
majorVersion=$(echo $newVersion | awk -F '.' '{print $1}')
git fetch && git checkout origin/v1
oldVersion=$(npm -j list setup-captain | jq -r .version)
latestVersion=$(echo "$newVersion $oldVersion" | sed 's/\ /\n/' | sort -rV | head -n 1)
if [[ "$majorVersion" != "1" ]]; then
echo "Major version needs to be '1' on v1 branch"
exit 1
fi
if [[ $(echo $newVersion | grep "-") ]]; then
echo "pre-release versions are not allowed on v1 branch"
exit 1
fi
if [[ "$newVersion" == "$oldVersion" ]]; then
echo "Version number was not changed"
exit 1
fi
if [[ "$latestVersion" != "$newVersion" ]]; then
echo "Version number was not increased"
exit 1
fi