-
Notifications
You must be signed in to change notification settings - Fork 3
46 lines (38 loc) · 1.46 KB
/
ensure-version-increment.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
# This workflow runs on any PRs that are targeting main, and ensures that the version in pyproject.toml is incremented
name: Check Version Increment
on:
pull_request:
branches:
- 'main'
concurrency:
# SHA is added to the end if on `main` to let all main workflows run
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ github.ref == 'refs/heads/main' && github.sha || '' }}
cancel-in-progress: true
jobs:
check-version:
name: Check version increment
runs-on: ubuntu-latest
steps:
- name: Clean workspace
uses: Chia-Network/actions/clean-workspace@main
- name: Checkout current branch
uses: actions/checkout@v3
with:
path: branch-repo
- name: Checkout main
uses: actions/checkout@v3
with:
ref: main
path: main-repo
- name: Install yq
run: pip install yq
- name: Check Versions
run: |
main_version=$(cat $GITHUB_WORKSPACE/main-repo/pyproject.toml | tomlq -r '.tool.poetry.version')
branch_version=$(cat $GITHUB_WORKSPACE/branch-repo/pyproject.toml | tomlq -r '.tool.poetry.version')
echo "Main version: $main_version"
echo "Branch version: $branch_version"
if [[ "$branch_version" == "$main_version" ]]; then
echo "Version in pyproject.toml on this branch is not changing. Version must incremenet for a merge to main"
exit 1
fi