Skip to content

Commit e8f919b

Browse files
authored
skill to help bump and release (#3305)
* skill to help bump and release * update readme.md
1 parent d620544 commit e8f919b

2 files changed

Lines changed: 84 additions & 3 deletions

File tree

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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.

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ pnpm clean
3636

3737
**Semi-auto:**
3838

39-
Branch `publish/auto-release` should be automatically updated with the latest changelog. Give it 5min after merging a PR or check the status of the [Release action](https://github.com/Azure/autorest.python/actions/workflows/prepare-auto-release-branch.yml)
40-
41-
Then go to https://github.com/Azure/autorest.python/pull/new/publish/auto-release and create this PR.
39+
Follow https://github.com/Azure/autorest.python/blob/main/.github/skills/bump-and-release/SKILL.md to make a release PR.
40+
After it merged, trigger [release pipeline](https://dev.azure.com/azure-sdk/internal/_build?definitionId=1668) to release new version.
4241

4342
## Contributing
4443

0 commit comments

Comments
 (0)