-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (46 loc) · 1.59 KB
/
version_checks.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
name: Run versioning checks
on:
pull_request:
types: [opened, synchronize, edited, reopened]
branches: [ main, develop ]
jobs:
version_checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: "0"
path: "pr"
- uses: actions/checkout@v2
with:
ref: ${{ github.base_ref }}
path: "base"
- uses: actions/setup-python@v2
with:
python-version: '3.9.x'
- name: Install Dependencies
run: pip install pyyaml
- name: Verify Package Version
working-directory: "pr"
run: |
pkg_ver="$(python setup.py -V)"
echo "Package version is $pkg_ver"
if ! git rev-parse --verify "refs/tags/v$pkg_ver" &>/dev/null; then
echo "[OK] Package version was not yet tagged"
else
echo "[ERR] The current package version has been tagged previously. The first merge after a release must bump the package version." >&2
exit 1
fi
- name: Verify OpenAPI version
run: |
if ! diff -wB pr/datameta/api/openapi.yaml base/datameta/api/openapi.yaml; then
echo "[INFO] OpenAPI specification has changes"
if [ "$(./pr/utils/openapi_version.py < pr/datameta/api/openapi.yaml)" == "$(./pr/utils/openapi_version.py < base/datameta/api/openapi.yaml)" ]; then
echo "[ERR] OpenAPI specification needs API version bump" >&2
exit 1
else
echo "[OK] OpenAPI specification contains new API version"
fi
else
echo "[OK] OpenAPI specification unchanged"
fi