Create release notes and bump SDK version #104
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Create release notes and bump SDK version | |
| "on": | |
| workflow_dispatch: # Allows manual triggering from GitHub Actions | |
| inputs: | |
| set_version: | |
| description: optionally set a specific SDK version | |
| type: string | |
| schedule: | |
| - cron: 30 18 * * * | |
| permissions: | |
| contents: write | |
| pull-requests: write # Required to create and manage PRs | |
| jobs: | |
| generate-docs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Step 1: Checkout the main branch | |
| - name: Checkout Main Branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| fetch-depth: 0 | |
| # Step 2: Set up Python | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.10" | |
| # Step 3: Install Python Dependencies | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install packaging | |
| # Step 4: Run Python script with optional version argument | |
| - name: Run SDK Docs Script | |
| run: | | |
| VERSION="${{ github.event.inputs.set_version }}" | |
| if [ -n "$VERSION" ]; then | |
| echo "Running with manual version: $VERSION" | |
| python scripts/bump_sdk_version_and_update_release_doc.py "$VERSION" | |
| else | |
| echo "Running without manual version" | |
| python scripts/bump_sdk_version_and_update_release_doc.py | |
| fi | |
| # Step 5: Create new branch and handle existing PRs | |
| - name: Create or reset branch | |
| run: | | |
| BRANCH_NAME="sdk/bump-version" | |
| # Check if the branch already exists remotely | |
| if git ls-remote --heads origin | grep -q "refs/heads/$BRANCH_NAME"; then | |
| echo "Branch $BRANCH_NAME already exists. Deleting and recreating..." | |
| git push origin --delete "$BRANCH_NAME" | |
| fi | |
| # Delete local branch if it exists | |
| git branch -D "$BRANCH_NAME" || true | |
| # Step 6: Commit and Push Changes | |
| - name: Commit and Push Changes | |
| run: | | |
| git config --local user.name "github-actions[bot]" | |
| git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| git commit -m "Bump SDK version based on dependency bumps" || echo "No changes to commit" | |
| # Step 7: Push to the remote branch | |
| - name: Create Pull Request | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| commit-message: "Auto-generate SDK Docs and Readme" | |
| branch: "sdk/bump-version" | |
| title: "Bump SDK version based on dependency bumps" | |
| body: "This PR includes version bump changes from python script." |