-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (64 loc) · 2.32 KB
/
Copy pathcheck-release.yml
File metadata and controls
76 lines (64 loc) · 2.32 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
name: Check for New Semble Release
on:
schedule:
# Run weekly on Mondays at 9am UTC
- cron: "0 9 * * 1"
workflow_dispatch:
permissions:
contents: write
jobs:
check:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.check.outputs.new_version }}
should_build: ${{ steps.check.outputs.should_build }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for new semble release
id: check
run: |
# Get latest version from PyPI
LATEST=$(curl -s https://pypi.org/pypi/semble/json | python3 -c "import sys, json; print(json.load(sys.stdin)['info']['version'])")
echo "Latest semble version on PyPI: $LATEST"
# Check if we already have a tag for this version
if git rev-parse "v${LATEST}" >/dev/null 2>&1; then
echo "Tag v${LATEST} already exists, skipping."
echo "should_build=false" >> "$GITHUB_OUTPUT"
else
echo "New version detected: ${LATEST}"
echo "new_version=${LATEST}" >> "$GITHUB_OUTPUT"
echo "should_build=true" >> "$GITHUB_OUTPUT"
fi
update-and-build:
needs: check
if: needs.check.outputs.should_build == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Update semble dependency
run: |
VERSION=${{ needs.check.outputs.new_version }}
# Update pyproject.toml to pin the new version
sed -i "s/\"semble>=.*\"/\"semble>=${VERSION}\"/" pyproject.toml
sed -i "s/\"semble\[mcp\]>=.*\"/\"semble[mcp]>=${VERSION}\"/" pyproject.toml
# Update the lock file
uv lock
- name: Commit and tag
run: |
VERSION=${{ needs.check.outputs.new_version }}
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add pyproject.toml uv.lock
git commit -m "chore: bump semble to v${VERSION}" || echo "No changes to commit"
git tag "v${VERSION}"
git push origin main --tags