-
Notifications
You must be signed in to change notification settings - Fork 19
48 lines (40 loc) · 1.38 KB
/
auto-bump-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
name: Auto Bump Version
on:
push:
branches:
- main
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Get current version
run: |
current_version=$(grep 'version =' pyproject.toml | cut -d'"' -f2)
echo "CURRENT_VERSION=$current_version" >> $GITHUB_ENV
- name: Bump version
run: |
IFS=. read -r major minor patch <<< "${CURRENT_VERSION}"
((patch++))
new_version="${major}.${minor}.${patch}"
echo "NEW_VERSION=$new_version" >> $GITHUB_ENV
- name: Update version in meta.yaml
run: |
sed -i "s/version: .*/version: $NEW_VERSION/" vedastro/meta.yaml
- name: Update version in setup.py
run: |
sed -i "s/version='.*'/version='$NEW_VERSION'/" setup.py
- name: Update version in pyproject.toml
run: |
sed -i "s/version = \".*\"/version = \"$NEW_VERSION\"/" pyproject.toml
- name: Commit changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add .
git commit -m "Auto bump version to $NEW_VERSION"
git push origin main