|
| 1 | +--- |
| 2 | +name: bump-and-release |
| 3 | +description: Bump dependency "@typespec/http-client-python" and release new versions for Azure/autorest.python repo. Use when user wants to bump, update, or upgrade the @typespec/http-client-python dependency, create a release PR, or publish new versions of autorest.python and typespec-python packages. |
| 4 | +--- |
| 5 | + |
| 6 | +# Bump and Release |
| 7 | + |
| 8 | +Bump the "@typespec/http-client-python" dependency and create a release PR for the Azure/autorest.python repository. |
| 9 | + |
| 10 | +## Context Variables |
| 11 | + |
| 12 | +- **BASE_BRANCH**: The branch to base changes on (default: "main") |
| 13 | +- **CURRENT_DATE**: Current date in YYYY-MM-DD format (e.g., "2025-01-01") |
| 14 | + |
| 15 | +## Workflow |
| 16 | + |
| 17 | +### Step 1: Prepare Branch |
| 18 | + |
| 19 | +Navigate to the root folder of "Azure/autorest.python" repo. |
| 20 | + |
| 21 | +**If BASE_BRANCH is "main":** |
| 22 | +```bash |
| 23 | +git reset HEAD && git checkout . && git checkout origin/main && git pull origin main && git checkout -b publish/release-{{CURRENT_DATE}} |
| 24 | +``` |
| 25 | + |
| 26 | +**If BASE_BRANCH is not "main":** |
| 27 | +```bash |
| 28 | +git reset HEAD && git checkout . && git fetch origin {{BASE_BRANCH}} && git checkout {{BASE_BRANCH}} |
| 29 | +``` |
| 30 | + |
| 31 | +### Step 2: Get Latest Version and Update Dependencies |
| 32 | + |
| 33 | +1. Get the latest VERSION of "@typespec/http-client-python" from npm: |
| 34 | + ```bash |
| 35 | + npm view @typespec/http-client-python version |
| 36 | + ``` |
| 37 | + |
| 38 | +2. Update the version of "@typespec/http-client-python" to `~{{VERSION}}` in both files: |
| 39 | + - `packages/autorest.python/package.json` |
| 40 | + - `packages/typespec-python/package.json` |
| 41 | + |
| 42 | +### Step 3: Run Version Tool |
| 43 | + |
| 44 | +Run the change version command: |
| 45 | +```bash |
| 46 | +pnpm change version |
| 47 | +``` |
| 48 | + |
| 49 | +Verify at least 4 files are changed: |
| 50 | +- `packages/autorest.python/package.json` |
| 51 | +- `packages/autorest.python/CHANGELOG.md` |
| 52 | +- `packages/typespec-python/package.json` |
| 53 | +- `packages/typespec-python/CHANGELOG.md` |
| 54 | + |
| 55 | +### Step 4: Check for Minor Version Bump |
| 56 | + |
| 57 | +The version tool calculates the next version but may choose patch instead of minor incorrectly. |
| 58 | + |
| 59 | +1. Run `git diff` to inspect updated CHANGELOG.md files |
| 60 | +2. If any CHANGELOG.md contains "### Features", upgrade to minor version instead of patch version |
| 61 | +3. Update version numbers in all 4 files: |
| 62 | + - `packages/autorest.python/package.json` |
| 63 | + - `packages/autorest.python/CHANGELOG.md` |
| 64 | + - `packages/typespec-python/package.json` |
| 65 | + - `packages/typespec-python/CHANGELOG.md` |
| 66 | + |
| 67 | +### Step 5: Build and Stage |
| 68 | + |
| 69 | +```bash |
| 70 | +pnpm install && pnpm build && git add -u |
| 71 | +``` |
| 72 | + |
| 73 | +### Step 6: Commit and Push |
| 74 | + |
| 75 | +```bash |
| 76 | +git commit -m "bump version" |
| 77 | +git push origin HEAD |
| 78 | +``` |
| 79 | + |
| 80 | +### Step 7: Create PR |
| 81 | + |
| 82 | +If no existing PR exists for the current branch, create a new pull request targeting the BASE_BRANCH. |
0 commit comments