Skip to content

Commit 32cc4fc

Browse files
authored
Add changeset CLI integration (#316)
* Add changeset cli * Move @changesets/cli dependency to devDependencies
1 parent ad997ab commit 32cc4fc

File tree

6 files changed

+460
-13
lines changed

6 files changed

+460
-13
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/changelog.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const changelogFunctions = {
2+
getReleaseLine: async (changeset, type, options) => {
3+
let prefix = '🎉';
4+
if (type === 'major') {
5+
prefix = '🎉';
6+
} else if (type === 'minor') {
7+
prefix = '🚀';
8+
} else if (type === 'patch') {
9+
prefix = '🐛';
10+
}
11+
if (changeset && changeset.summary) {
12+
const summary = changeset.summary || '';
13+
if (summary.indexOf('Docs') > -1) {
14+
prefix = '📝';
15+
}
16+
if (summary.indexOf('Chore') > -1 || summary.indexOf('grafana-plugin-sdk-go') > -1 || summary.indexOf('compiled') > -1) {
17+
prefix = '⚙️';
18+
}
19+
return [prefix, summary].join(' ');
20+
}
21+
return [prefix, changeset?.summary].join(' ');
22+
},
23+
getDependencyReleaseLine: async (changesets, dependenciesUpdated, options) => {
24+
return '\n';
25+
},
26+
};
27+
28+
module.exports = changelogFunctions;
29+

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.0.5/schema.json",
3+
"changelog": "./changelog.js",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ Make sure you have the following dependencies installed first:
4646
mage -v
4747
```
4848

49-
## Build a release for the Google BigQuery data source plugin
49+
## Submitting PR
5050

51-
You need to have commit rights to the GitHub repository to publish a release.
51+
If you are creating a PR, ensure to run `yarn changeset` from your branch. Provide the details accordingly. It will create `*.md` file inside `./.changeset` folder. Later during the release, based on these changesets, package version will be bumped and changelog will be generated.
52+
53+
## Releasing & Bumping version
54+
55+
To create a new release, execute `yarn changeset version`. This will update the Changelog and bump the version in `package.json` file. Commit those changes. Run the `Plugins - CD` GitHub Action to publish the new release.
5256

53-
1. Update the version number in the `package.json` file.
54-
2. Update the `CHANGELOG.md` with the changes contained in the release.
55-
3. Commit the changes to `main` branch and push to GitHub.
56-
4. Follow the Drone release process that you can find [here](https://github.com/grafana/integrations-team/wiki/Plugin-Release-Process#drone-release-process)
5757

5858
# Plugin Technical Documentation
5959

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
},
4545
"devDependencies": {
4646
"@babel/core": "^7.21.4",
47+
"@changesets/cli": "^2.27.12",
4748
"@grafana/eslint-config": "^8.0.0",
4849
"@grafana/plugin-e2e": "^1.16.0",
4950
"@grafana/tsconfig": "^2.0.0",

0 commit comments

Comments
 (0)