-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (77 loc) · 2.91 KB
/
Copy pathpatch-bump-develop.yml
File metadata and controls
89 lines (77 loc) · 2.91 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Auto Patch Version Bump on Develop PR
on:
pull_request:
types: [closed]
branches: [develop]
concurrency:
group: patch-bump-develop
cancel-in-progress: false
jobs:
bump-patch:
permissions:
contents: write
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: "0.9.21"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Compute new patch version
id: version
run: |
set -euo pipefail
CURRENT=$(python3 -c "
import tomllib, pathlib
print(tomllib.loads(pathlib.Path('pyproject.toml').read_text())['project']['version'])
")
if ! echo "$CURRENT" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
echo "ERROR: version '$CURRENT' is not a valid semver (X.Y.Z) — cannot compute patch bump" >&2
exit 1
fi
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
NEW="$MAJOR.$MINOR.$((PATCH + 1))"
echo "old=$CURRENT" >> "$GITHUB_OUTPUT"
echo "new=$NEW" >> "$GITHUB_OUTPUT"
- name: Update pyproject.toml
run: |
python3 - <<'EOF'
import pathlib, os, sys
p = pathlib.Path("pyproject.toml")
old_ver = f'version = "{os.environ["OLD_VERSION"]}"'
new_ver = f'version = "{os.environ["NEW_VERSION"]}"'
old_content = p.read_text()
new_content = old_content.replace(old_ver, new_ver, 1)
if new_content == old_content:
print(f"ERROR: version pattern {old_ver!r} not found in pyproject.toml", file=sys.stderr)
sys.exit(1)
p.write_text(new_content)
EOF
env:
OLD_VERSION: ${{ steps.version.outputs.old }}
NEW_VERSION: ${{ steps.version.outputs.new }}
- name: Sync version artifacts
run: python3 scripts/sync_versions.py
- name: Configure git auth for private deps
run: git config --global url."https://${{ secrets.GH_USER }}:${{ secrets.GH_PAT }}@github.com/TalonT-Org/".insteadOf "https://github.com/TalonT-Org/"
- name: Regenerate uv.lock
run: uv lock
- name: Commit and push version bump to develop
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add pyproject.toml src/autoskillit/.claude-plugin/plugin.json uv.lock
if git diff --cached --quiet; then
echo "Nothing to commit"
else
git commit -m "chore: bump version to ${{ steps.version.outputs.new }}"
git push origin develop
fi