Skip to content

Commit 15d69a1

Browse files
committed
Add auto version management
1 parent f4e35ff commit 15d69a1

File tree

1 file changed

+40
-3
lines changed

1 file changed

+40
-3
lines changed

.github/workflows/generate-vicutils-docs.yml

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
uses: actions/checkout@v4
1919
with:
2020
token: ${{ secrets.GITHUB_TOKEN }}
21+
fetch-depth: 0
2122

2223
- name: Setup Python
2324
uses: actions/setup-python@v4
@@ -30,6 +31,37 @@ jobs:
3031
echo "pdoc3 version:"
3132
pdoc --version
3233
34+
- name: Increment version
35+
run: |
36+
# Create .version file if it doesn't exist
37+
if [ ! -f .version ]; then
38+
echo "0.1" > .version
39+
echo "Created .version file with initial version 0.1"
40+
fi
41+
42+
# Read current version
43+
current_version=$(cat .version)
44+
echo "Current version: $current_version"
45+
46+
# Increment version (major.minor format)
47+
IFS='.' read -r major minor <<< "$current_version"
48+
new_minor=$((minor + 1))
49+
new_version="${major}.${new_minor}"
50+
51+
echo "New version: $new_version"
52+
53+
# Save new version
54+
echo "$new_version" > .version
55+
56+
# Update setup.py
57+
sed -i "s/version=\"[^\"]*\"/version=\"$new_version\"/" setup.py
58+
59+
echo "=== Updated files ==="
60+
echo "Version file:"
61+
cat .version
62+
echo "setup.py:"
63+
grep 'version=' setup.py
64+
3365
- name: Check vicutils directory
3466
run: |
3567
echo "=== Contents of vicutils directory ==="
@@ -63,11 +95,16 @@ jobs:
6395
run: |
6496
git config --local user.name "Vic-Nas"
6597
git config --local user.email "github-actions@github.com"
98+
99+
# Add all changes
100+
git add .version setup.py
66101
git add vicutils/*.html || echo "No HTML files to add"
102+
67103
if git diff --staged --quiet; then
68104
echo "No changes to commit"
69105
else
70-
echo "Committing changes"
71-
git commit -m "Auto-generate VicUtils documentation [skip ci]"
106+
new_version=$(cat .version)
107+
echo "Committing changes for version $new_version"
108+
git commit -m "Auto-generate docs and bump version to $new_version [skip ci]"
72109
git push
73-
fi
110+
fi

0 commit comments

Comments
 (0)