Skip to content

Commit

Permalink
use changesets to manage changelog automatically (#2524)
Browse files Browse the repository at this point in the history
* update dependency

* add changeset init

* add changelog

* Create prepare-auto-release-branch.yml

* update

* update readme.md

* udpate readme.md

* Update little-masks-grin.md
  • Loading branch information
msyyc authored Apr 16, 2024
1 parent 500ad67 commit d773b87
Show file tree
Hide file tree
Showing 9 changed files with 895 additions and 267 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
6 changes: 6 additions & 0 deletions .changeset/little-masks-grin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@autorest/python": patch
"@azure-tools/typespec-python": patch
---

add changesets to manage changelog #2524
35 changes: 35 additions & 0 deletions .github/workflows/prepare-auto-release-branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Prepare Auto Release Branch

# Disable as MS Org doesn't allow github action to create PR anymore. Can be re-added if a solution is found.
on:
push:
branches:
- main

concurrency: ${{ github.workflow }}-${{ github.ref }}

permissions:
pull-requests: write
contents: write

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2

- name: Setup Node.js 18.x
uses: actions/setup-node@v2
with:
node-version: 18.x

- run: npm install -g pnpm@7.27.1
name: Install PNPM

- run: pnpm install
name: Install dependencies

- name: Create release branch
run: node ./eng/publish.mjs
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ pnpm watch
pnpm clean
```

## Release a new version

**Semi-auto:**

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)

Then go to https://github.com/Azure/autorest.python/pull/new/publish/auto-release and create this PR. After PR created, please update `Minor Changes`/`Patch Changes` of changelog with existing items `New Features`/`Bug Fixes`/`Other Changes`.

## Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a
Expand Down
23 changes: 23 additions & 0 deletions eng/publish.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { execSync } from "child_process";

const branchName = "publish/auto-release";

execSync(`pnpm changeset version`);
const stdout = execSync(`git status --porcelain`).toString();

if (stdout.trim() !== "") {
console.log("Commiting the following changes:\n", stdout);

execSync(
`git -c user.email=autochangesetbot@microsoft.com -c user.name="Microsoft Auto Changeset Bot" commit -am "Bump versions"`,
);
execSync(`git push origin HEAD:${branchName} --force`);

console.log();
console.log("-".repeat(160));
console.log("| Link to create the PR");
console.log(`| https://github.com/Azure/cadl-ranch/pull/new/${branchName} `);
console.log("-".repeat(160));
} else {
console.log("No changes to publish");
}
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@
},
"homepage": "https://github.com/Azure/autorest.python#readme",
"devDependencies": {
"@azure-tools/cadl-ranch": "~0.11.3",
"@typespec/prettier-plugin-typespec": "~0.51.0",
"@azure-tools/cadl-ranch": "~0.12.7",
"@changesets/cli": "^2.27.1",
"@typespec/prettier-plugin-typespec": "~0.55.0",
"autorest": "3.6.3",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
Expand Down
6 changes: 3 additions & 3 deletions packages/typespec-python/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@
"dependencies": {
"@autorest/python": "workspace:^",
"js-yaml": "~4.1.0",
"@typespec/openapi3": "latest"
"@typespec/openapi3": "~0.55.0"
},
"devDependencies": {
"@azure-tools/typespec-azure-resource-manager": "~0.41.0",
"@azure-tools/typespec-autorest": "~0.41.0",
"@azure-tools/cadl-ranch-expect": "~0.13.1",
"@azure-tools/cadl-ranch-expect": "~0.13.3",
"@azure-tools/cadl-ranch-specs": "~0.31.8",
"@types/js-yaml": "~4.0.5",
"@types/mocha": "~10.0.1",
"@types/node": "^18.16.3",
"@typespec/eslint-config-typespec": "~0.55.0",
"@typespec/openapi": "~0.55.0",
"c8": "~7.13.0",
"eslint": "^8.44.0",
"eslint": "^8.56.0",
"mocha": "~10.2.0",
"rimraf": "~5.0.0",
"typescript": "~5.1.3",
Expand Down
Loading

0 comments on commit d773b87

Please sign in to comment.