mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 12:42:35 +08:00
Packages: update versioning and release process (#18195)
This commit is contained in:
@ -672,6 +672,21 @@ jobs:
|
||||
name: Release next packages
|
||||
command: './scripts/circle-release-next-packages.sh'
|
||||
|
||||
release-packages:
|
||||
docker:
|
||||
- image: circleci/node:10
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: Boostrap lerna
|
||||
command: 'npx lerna bootstrap'
|
||||
- run:
|
||||
name: npm - Prepare auth token
|
||||
command: 'echo //registry.npmjs.org/:_authToken=$NPM_TOKEN >> ~/.npmrc'
|
||||
- run:
|
||||
name: Release packages
|
||||
command: ./scripts/build/release-packages.sh "${CIRCLE_TAG}"
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
build-master:
|
||||
@ -754,6 +769,7 @@ workflows:
|
||||
- build-all
|
||||
- test-frontend
|
||||
filters: *filter-only-master
|
||||
|
||||
release:
|
||||
jobs:
|
||||
- build-all:
|
||||
@ -810,6 +826,18 @@ workflows:
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
filters: *filter-only-release
|
||||
- release-packages:
|
||||
requires:
|
||||
- build-all
|
||||
- test-backend
|
||||
- test-frontend
|
||||
- codespell
|
||||
- lint-go
|
||||
- shellcheck
|
||||
- mysql-integration-test
|
||||
- postgres-integration-test
|
||||
- build-oss-msi
|
||||
filters: *filter-only-release
|
||||
- build-oss-msi:
|
||||
requires:
|
||||
- build-all
|
||||
|
@ -2,5 +2,5 @@
|
||||
"npmClient": "yarn",
|
||||
"useWorkspaces": true,
|
||||
"packages": ["packages/*"],
|
||||
"version": "6.4.0-alpha.44"
|
||||
"version": "6.4.0-pre"
|
||||
}
|
||||
|
@ -163,10 +163,12 @@
|
||||
"prettier:write": "prettier --list-different \"**/*.{ts,tsx,scss}\" --write",
|
||||
"precommit": "grafana-toolkit precommit",
|
||||
"themes:generate": "ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/generateSassVariableFiles.ts",
|
||||
"packages:prepare": "lerna run clean && npm run test && lerna version --tag-version-prefix=\"packages@\" -m \"Packages: publish %s\" --no-push",
|
||||
"packages:prepare": "lerna version --no-push --no-git-tag-version --force-publish --exact",
|
||||
"packages:build": "lerna run clean && lerna run build",
|
||||
"packages:publish": "lerna publish from-package --contents dist",
|
||||
"packages:publishNext": "lerna publish from-package --contents dist --dist-tag next --yes"
|
||||
"packages:publishLatest": "lerna publish from-package --contents dist --yes",
|
||||
"packages:publishNext": "lerna publish from-package --contents dist --dist-tag next --yes",
|
||||
"packages:publishCanary": "lerna publish from-package --contents dist --dist-tag canary --yes"
|
||||
},
|
||||
"husky": {
|
||||
"hooks": {
|
||||
|
@ -1,15 +1,50 @@
|
||||
## Grafana frontend packages
|
||||
|
||||
## Releasing new version
|
||||
## Versioning
|
||||
We use [Lerna](https://github.com/lerna/lerna) for packages versioning and releases
|
||||
|
||||
All packages are versioned according to the current Grafana version:
|
||||
- Grafana v6.3.0-alpha1 -> @grafana/* packages @ 6.3.0-alpha.1
|
||||
- Grafana v6.2.5 -> @grafana/* packages @ 6.2.5
|
||||
- Grafana - master branch version (based on package.json, i.e. 6.4.0-pre) -> @grafana/* packages @ 6.4.0-pre-<COMMIT-SHA> (see details below about packages publishing channels)
|
||||
|
||||
> Please note that @grafana/toolkit, @grafana/ui, @grafana/data & @grafana/runtime packages are considered ALPHA even though they are not released as alpha versions
|
||||
|
||||
### Stable releases
|
||||
> **Even though packages are released under a stable version, they are considered ALPHA until further notice!**
|
||||
|
||||
Stable releases are published under `latest` tag on npm.
|
||||
|
||||
### Alpha and beta releases
|
||||
Alpha and beta releases are published under `next` tag on npm.
|
||||
|
||||
### Automatic pre-releases
|
||||
Every commit to master that has changes within `packages` directory is a subject of npm packages release.
|
||||
*ALL* packages will be released under version from lerna.json file with commit SHA added to it:
|
||||
|
||||
```
|
||||
<lerna.json version>-<COMMIT_SHA>
|
||||
```
|
||||
|
||||
Automatic prereleases are published under `canary` dist tag.
|
||||
|
||||
### Manual release
|
||||
1. Run `packages:prepare` script from root directory. This will perform cleanup, run all tests and bump version for all packages. Also, it will create `@packages@[version]` tag and version bump commit with `Packages: publish [version]` message.
|
||||
2. Run `packages:build` script that will prepare distribution packages.
|
||||
3. Run `packages:publish` to publish new versions
|
||||
- add `--dist-tag next` to publish under `next` tag
|
||||
4. Push version commit
|
||||
> All of the steps below should be performed on a release branch, according to Grafana Release Guide
|
||||
|
||||
> Make sure you are logged in to npm in your terminal and that you are a part of Grafana org on npm
|
||||
|
||||
1. Run `yarn packages:prepare` script from root directory. This will perform tests on the packages and prompt for version of the packages. The version should be the same as the one being released.
|
||||
- Make sure you use semver convention. So, *place a dot between prerelease id and prelease number*!!! i.e. 6.3.0-alpha.1
|
||||
- Make sure you confirm the version bump when prompted!
|
||||
2. Commit changes (lerna.json & package.json files) - *"Packages version update: \<VERSION\>"*
|
||||
3. Run `yarn packages:build` script that will prepare distribution packages in `packages/grafana-*/dist`. These directories are going to be published to npm
|
||||
4. Depending whether or not it's a prerelease:
|
||||
- When releasing a prelease run `packages:publishNext` to publish new versions.
|
||||
- When releasing a stable version run `packages:publishLatest` to publish new versions.
|
||||
|
||||
5. Push version commit to the release branch
|
||||
|
||||
### Building individual packages
|
||||
To build induvidual packages run `grafana-toolkit package:build --scope=<ui|toolkit|runtime|data>`
|
||||
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Grafana Data Library
|
||||
|
||||
This package holds the root data types and functions used within Grafana.
|
||||
> **@grafana/data is currently in ALPHA**. Core API is unstable and can be a subject of breaking changes!
|
||||
|
||||
This package holds the root data types and functions used within Grafana.
|
||||
|
@ -2,7 +2,7 @@
|
||||
"author": "Grafana Labs",
|
||||
"license": "Apache-2.0",
|
||||
"name": "@grafana/data",
|
||||
"version": "6.4.0-alpha.44",
|
||||
"version": "6.4.0-pre",
|
||||
"description": "Grafana Data Library",
|
||||
"keywords": [
|
||||
"typescript"
|
||||
|
@ -1,3 +1,5 @@
|
||||
# Grafana Runtime library
|
||||
|
||||
This package allows access to grafana services. It requires Grafana to be running already and the functions to be imported as externals.
|
||||
> **@grafana/runtime is currently in ALPHA**. Core API is unstable and can be a subject of breaking changes!
|
||||
|
||||
This package allows access to grafana services. It requires Grafana to be running already and the functions to be imported as externals.
|
||||
|
@ -2,7 +2,7 @@
|
||||
"author": "Grafana Labs",
|
||||
"license": "Apache-2.0",
|
||||
"name": "@grafana/runtime",
|
||||
"version": "6.4.0-alpha.44",
|
||||
"version": "6.4.0-pre",
|
||||
"description": "Grafana Runtime Library",
|
||||
"keywords": [
|
||||
"grafana",
|
||||
|
@ -1,14 +1,17 @@
|
||||
|
||||
> **@grafana/toolkit is currently in ALPHA**. Core API is unstable and can be a subject of breaking changes!
|
||||
|
||||
# grafana-toolkit
|
||||
grafana-toolkit is CLI that enables efficient development of Grafana extensions
|
||||
|
||||
|
||||
## Rationale
|
||||
Historically, creating Grafana extension was an exercise of reverse engineering and ceremony around testing, developing and eventually building the plugin. We want to help our community to focus on the core value of their plugins rather than all the setup required to develop an extension.
|
||||
|
||||
## Installation
|
||||
|
||||
You can either add grafana-toolkit to your extension's `package.json` file by running
|
||||
`yarn add @grafana/toolkit` `npm instal @grafana/toolkit` or use one of our extension templates:
|
||||
`yarn add @grafana/toolkit` or `npm instal @grafana/toolkit`, or use one of our extension templates:
|
||||
- [React Panel](https://github.com/grafana/simple-react-panel)
|
||||
- [Angular Panel](https://github.com/grafana/simple-angular-panel)
|
||||
|
||||
@ -92,7 +95,7 @@ Yes! grafana-toolkit supports Typescript by default.
|
||||
### How can I test my extension?
|
||||
grafana-toolkit comes with Jest as a test runner.
|
||||
|
||||
Internally at Grafana we use Enzyme. If you are developing React extension and you want to configure Enzyme as a testing utility, you need to configure `enzyme-adapter-react`. To do so create `[YOUR_EXTENSION]/config/jest-setup.ts` file that will provide necessary setup. Copy the following code into that file to get Enzyme working with React:
|
||||
Internally at Grafana we use Enzyme. If you are developing React extension and you want to configure Enzyme as a testing utility, you need to configure `enzyme-adapter-react`. To do so create `<YOUR_EXTENSION>/config/jest-setup.ts` file that will provide necessary setup. Copy the following code into that file to get Enzyme working with React:
|
||||
|
||||
```ts
|
||||
import { configure } from 'enzyme';
|
||||
@ -101,7 +104,7 @@ import Adapter from 'enzyme-adapter-react-16';
|
||||
configure({ adapter: new Adapter() });
|
||||
```
|
||||
|
||||
You can also setup Jest with shims of your needs by creating `jest-shim.ts` file in the same directory: `[YOUR_EXTENSION]/config/jest-shim.ts`
|
||||
You can also setup Jest with shims of your needs by creating `jest-shim.ts` file in the same directory: `<YOUR_EXTENSION>/config/jest-shim.ts`
|
||||
|
||||
### Can I provide custom setup for Jest?
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
"author": "Grafana Labs",
|
||||
"license": "Apache-2.0",
|
||||
"name": "@grafana/toolkit",
|
||||
"version": "6.4.0-alpha.44",
|
||||
"version": "6.4.0-pre",
|
||||
"description": "Grafana Toolkit",
|
||||
"keywords": [
|
||||
"grafana",
|
||||
|
@ -1,5 +1,7 @@
|
||||
# Grafana UI components library
|
||||
|
||||
> **@grafana/toolkit is currently in ALPHA**. Core API is unstable and can be a subject of breaking changes!
|
||||
|
||||
@grafana/ui is a collection of components used by [Grafana](https://github.com/grafana/grafana)
|
||||
|
||||
Our goal is to deliver Grafana's common UI elements for plugins developers and contributors.
|
||||
|
@ -2,7 +2,7 @@
|
||||
"author": "Grafana Labs",
|
||||
"license": "Apache-2.0",
|
||||
"name": "@grafana/ui",
|
||||
"version": "6.4.0-alpha.44",
|
||||
"version": "6.4.0-pre",
|
||||
"description": "Grafana Components Library",
|
||||
"keywords": [
|
||||
"grafana",
|
||||
|
40
scripts/build/release-packages.sh
Executable file
40
scripts/build/release-packages.sh
Executable file
@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
GRAFANA_TAG=${1:-}
|
||||
RELEASE_CHANNEL="latest"
|
||||
|
||||
if echo "$GRAFANA_TAG" | grep -q "^v"; then
|
||||
_grafana_version=$(echo "${GRAFANA_TAG}" | cut -d "v" -f 2)
|
||||
else
|
||||
echo "Provided tag is not a version tag, skipping packages release..."
|
||||
exit
|
||||
fi
|
||||
|
||||
if grep -q "beta" <<< "$GRAFANA_TAG"; then
|
||||
RELEASE_CHANNEL="next"
|
||||
fi
|
||||
|
||||
echo "$_grafana_version"
|
||||
|
||||
# Get current version from lerna.json
|
||||
# Since this happens on tagged branch, the lerna.json version and package.json file SHOULD be updated already
|
||||
# as specified in release guideline
|
||||
PACKAGE_VERSION=$(grep '"version"' lerna.json | cut -d '"' -f 4)
|
||||
|
||||
echo "Releasing grafana packages @ ${PACKAGE_VERSION} under ${RELEASE_CHANNEL} channel"
|
||||
|
||||
if [ $RELEASE_CHANNEL == "latest" ]; then
|
||||
SCRIPT="publishLatest"
|
||||
elif [ $RELEASE_CHANNEL == "next" ]; then
|
||||
SCRIPT="publishNext"
|
||||
else
|
||||
echo "Unknown channel, skipping packages release"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo $'\nBuilding packages'
|
||||
yarn packages:build
|
||||
|
||||
echo $'\nPublishing packages'
|
||||
yarn packages:${SCRIPT}
|
||||
|
@ -16,9 +16,13 @@ function unpublish_previous_canary () {
|
||||
for PACKAGE in ui toolkit data runtime
|
||||
do
|
||||
# dist-tag next to be changed to canary when https://github.com/grafana/grafana/pull/18195 is merged
|
||||
CURRENT_CANARY=$(npm view @grafana/${PACKAGE} dist-tags.next)
|
||||
echo "Unpublish @grafana/${PACKAGE}@${CURRENT_CANARY}"
|
||||
npm unpublish "@grafana/${PACKAGE}@${CURRENT_CANARY}"
|
||||
CURRENT_CANARY=$(npm view @grafana/${PACKAGE} dist-tags.canary)
|
||||
if [ -z "${CURRENT_CANARY}" ]; then
|
||||
echo "@grafana/${PACKAGE} - Nothing to unpublish"
|
||||
else
|
||||
echo "Unpublish @grafana/${PACKAGE}@${CURRENT_CANARY}"
|
||||
npm unpublish "@grafana/${PACKAGE}@${CURRENT_CANARY}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@ -57,6 +61,6 @@ else
|
||||
unpublish_previous_canary
|
||||
|
||||
echo $'\nPublishing packages'
|
||||
yarn packages:publishNext
|
||||
yarn packages:publishCanary
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user