Skip to content

Commit 8488cd3

Browse files
committed
update the build to package and tag
Signed-off-by: Craig Tracey <craig@arctir.com>
1 parent 46c11ab commit 8488cd3

1 file changed

Lines changed: 54 additions & 39 deletions

File tree

.github/workflows/regenerate-client.yml

Lines changed: 54 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ jobs:
5454
5555
echo "✓ Client generated"
5656
57+
- name: Update client version
58+
run: |
59+
# Update version in pyproject.toml to match API version
60+
sed -i 's/^version = .*/version = "${{ inputs.spec_version }}"/' pyproject.toml
61+
echo "✓ Updated version to ${{ inputs.spec_version }}"
62+
5763
- name: Install dependencies
5864
run: |
5965
poetry install --no-interaction
@@ -65,43 +71,52 @@ jobs:
6571
6672
- name: Run tests
6773
run: |
68-
poetry run pytest tests/ -v || echo "⚠️ Tests failed - review in PR"
74+
poetry run pytest tests/ -v
6975
70-
- name: Create Pull Request
71-
uses: peter-evans/create-pull-request@v6
72-
with:
73-
token: ${{ secrets.ARCTIR_GH_ACTIONS_TOKEN }}
74-
commit-message: |
75-
Update client for API v${{ inputs.spec_version }}
76-
77-
Auto-generated from devgraph@${{ inputs.spec_commit }}
78-
branch: api-update-${{ inputs.spec_version }}
79-
delete-branch: true
80-
title: "Update client for API v${{ inputs.spec_version }}"
81-
body: |
82-
## API Spec Update
83-
84-
- **API Version**: `${{ inputs.spec_version }}`
85-
- **Source Commit**: [${{ inputs.spec_commit }}](https://github.com/arctir/devgraph/commit/${{ inputs.spec_commit }})
86-
- **Spec URL**: https://github.com/arctir/devgraph-api/tree/v${{ inputs.spec_version }}
87-
88-
This PR was automatically generated when the API spec was updated.
89-
90-
### Checklist
91-
- [ ] Review generated code changes
92-
- [ ] Verify tests pass
93-
- [ ] Check for breaking changes
94-
- [ ] Update client version in `pyproject.toml` if needed
95-
- [ ] Update CHANGELOG.md
96-
97-
### Testing
98-
```bash
99-
poetry install
100-
poetry run pytest
101-
```
102-
103-
---
104-
🤖 Auto-generated by [regenerate-client workflow](https://github.com/arctir/devgraph-python-client/actions)
105-
labels: |
106-
automated
107-
api-update
76+
- name: Commit and push changes
77+
run: |
78+
git config user.name "github-actions[bot]"
79+
git config user.email "github-actions[bot]@users.noreply.github.com"
80+
81+
# Check if there are changes to commit
82+
if [[ -n $(git status -s) ]]; then
83+
git add .
84+
git commit -m "$(cat <<'EOF'
85+
Update client for API v${{ inputs.spec_version }}
86+
87+
Auto-generated from devgraph@${{ inputs.spec_commit }}
88+
Spec URL: https://github.com/arctir/devgraph-api/tree/v${{ inputs.spec_version }}
89+
90+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
91+
92+
Co-Authored-By: Claude <noreply@anthropic.com>
93+
EOF
94+
)"
95+
git push origin main
96+
echo "✓ Changes committed and pushed to main"
97+
98+
# Extract client version from pyproject.toml
99+
CLIENT_VERSION=$(grep '^version = ' pyproject.toml | sed 's/version = "\(.*\)"/\1/')
100+
101+
# Create and push tag
102+
git tag -fa "v${CLIENT_VERSION}" -m "Python client v${CLIENT_VERSION} for API v${{ inputs.spec_version }}"
103+
git push origin "v${CLIENT_VERSION}" --force
104+
echo "✓ Tagged as v${CLIENT_VERSION}"
105+
106+
# Build and publish to GitHub Package Registry
107+
poetry build
108+
poetry config repositories.github https://pypi.pkg.github.com/arctir
109+
poetry publish -r github -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
110+
echo "✓ Published to GitHub Package Registry"
111+
else
112+
echo "No changes to commit"
113+
fi
114+
115+
- name: Create summary
116+
if: always()
117+
run: |
118+
echo "## 🐍 Python Client Regenerated" >> $GITHUB_STEP_SUMMARY
119+
echo "" >> $GITHUB_STEP_SUMMARY
120+
echo "- **API Version**: \`${{ inputs.spec_version }}\`" >> $GITHUB_STEP_SUMMARY
121+
echo "- **Source Commit**: [${{ inputs.spec_commit }}](https://github.com/arctir/devgraph/commit/${{ inputs.spec_commit }})" >> $GITHUB_STEP_SUMMARY
122+
echo "- **Spec URL**: https://github.com/arctir/devgraph-api/tree/v${{ inputs.spec_version }}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)