Skip to content

Commit 7a1a8ac

Browse files
feat: align pyproject.toml version with gen.lock in SDK generation (#383)
* feat: add workflow to align pyproject.toml version with gen.lock Add a PR-triggered workflow that automatically updates pyproject.toml version to match gen.lock when speakeasybot creates/updates a PR. This fixes version mismatch between gen.lock and pyproject.toml caused by pyproject.toml being in .genignore (Speakeasy cannot update it). The workflow: - Triggers on PR events when gen.lock files change - Only runs for PRs from speakeasybot - Reads releaseVersion from gen.lock - Updates pyproject.toml using uv version - Commits and pushes the change * fix: strip quotes from version extraction in align workflow Handle potential quoted YAML values in gen.lock releaseVersion field.
1 parent ac5195f commit 7a1a8ac

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Align pyproject.toml version
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize]
6+
paths:
7+
- ".speakeasy/gen.lock"
8+
- "packages/azure/.speakeasy/gen.lock"
9+
- "packages/gcp/.speakeasy/gen.lock"
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
align-version:
16+
if: github.actor == 'speakeasybot'
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout PR branch
20+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
21+
with:
22+
ref: ${{ github.head_ref }}
23+
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6
26+
27+
- name: Align main SDK version
28+
if: hashFiles('.speakeasy/gen.lock') != ''
29+
run: |
30+
VERSION=$(grep 'releaseVersion:' .speakeasy/gen.lock | head -1 | awk '{print $2}' | tr -d '"')
31+
echo "Aligning main SDK to version: $VERSION"
32+
uv version "$VERSION"
33+
34+
- name: Align Azure SDK version
35+
if: hashFiles('packages/azure/.speakeasy/gen.lock') != ''
36+
run: |
37+
VERSION=$(grep 'releaseVersion:' packages/azure/.speakeasy/gen.lock | head -1 | awk '{print $2}' | tr -d '"')
38+
echo "Aligning Azure SDK to version: $VERSION"
39+
uv version "$VERSION" --directory packages/azure
40+
41+
- name: Align GCP SDK version
42+
if: hashFiles('packages/gcp/.speakeasy/gen.lock') != ''
43+
run: |
44+
VERSION=$(grep 'releaseVersion:' packages/gcp/.speakeasy/gen.lock | head -1 | awk '{print $2}' | tr -d '"')
45+
echo "Aligning GCP SDK to version: $VERSION"
46+
uv version "$VERSION" --directory packages/gcp
47+
48+
- name: Commit and push
49+
run: |
50+
git config user.email "action@github.com"
51+
git config user.name "GitHub Action"
52+
git add pyproject.toml packages/*/pyproject.toml 2>/dev/null || true
53+
if git diff --cached --quiet; then
54+
echo "No version change needed"
55+
else
56+
git commit -m "chore: align pyproject.toml version with gen.lock"
57+
git push
58+
fi

0 commit comments

Comments
 (0)