-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (46 loc) · 1.71 KB
/
CI_check_version.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
# This workflow will check that the code version was increased.
#
# It is triggered for any PR to the master branch.
#
# Warning: the code version must *absolutely* follow a semantic approach, i.e.:
# 10.0.1, 10.0.2.dev0 is valid
# 10.0, 10, is NOT valid !
#
# Copyright (c) 2022-2023 fpavogt; [email protected]
name: CI_check_version
on:
pull_request:
branches: [ master ]
jobs:
version:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.11'
- name: Install dependancies
run: |
python -m pip install --upgrade pip
pip install setuptools
shell: bash
- name: wget/cp the BASE and HEAD version files
# Here, I could get both the BASE and HEAD files with wget, but cp-ing the HEAD is safer,
# since we have cloned the repo anyway.
run: |
export VERSION_LOC=src/dvas/version.py
echo $GITHUB_HEAD_REF
echo $GITHUB_BASE_REF
wget -O base_version.tmp https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$GITHUB_BASE_REF/$VERSION_LOC
cp ./$VERSION_LOC head_version.tmp
shell: bash
- name: Check if the version was increased
run: |
HEAD_VERSION="$(grep VERSION head_version.tmp | grep -o '[[:alnum:]]*\.[[:alnum:]]*\.[[:alnum:]]*\.\?[[:alnum:]]*')"
echo "HEAD_VERSION:" $HEAD_VERSION
BASE_VERSION="$(grep VERSION base_version.tmp | grep -o '[[:alnum:]]*\.[[:alnum:]]*\.[[:alnum:]]*\.\?[[:alnum:]]*')"
echo "BASE_VERSION:" $BASE_VERSION
python ./.github/workflows/check_version.py $HEAD_VERSION $BASE_VERSION
shell: bash