Commit de705229 by Dominik Prokop Committed by GitHub

Build: Release packages under next tag when changes detected on master (#18062)

* Testing lerna on circle

* Remove dependency on test task, fix yarn

* yarn fix

* Run lerna from local bin

* Use packages cache, run lern via npx

* Add packages:build

* Install packages before release

* Remove cache tmp

* add lerna bootstrap

* temporarily add tsignore

* lerna add data package to ui

* Remove @types/lodas resolution

* Try any...

* Typo fix

* Add publishing packages

* update lerna publish script

* Reset git befgore publishing package

* Correct lerna version

* Packages version bump

* Remove postpublish

* Publish to npm

* Set git creds before commit

* Rename job and run it after frontend tests and build passes

* Run next packages release on master but not when tagged with release

* Minor copy

* Update circle's config

* Fix config
parent 8e0f091f
...@@ -623,6 +623,21 @@ jobs: ...@@ -623,6 +623,21 @@ jobs:
echo "-- no changes to docs files --" echo "-- no changes to docs files --"
fi fi
release-next-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 next packages
command: './scripts/circle-release-next-packages.sh'
workflows: workflows:
version: 2 version: 2
build-master: build-master:
...@@ -694,6 +709,11 @@ workflows: ...@@ -694,6 +709,11 @@ workflows:
requires: requires:
- end-to-end-test - end-to-end-test
filters: *filter-only-master filters: *filter-only-master
- release-next-packages:
requires:
- build-all
- test-frontend
filters: *filter-only-master
release: release:
jobs: jobs:
- build-all: - build-all:
...@@ -803,3 +823,4 @@ workflows: ...@@ -803,3 +823,4 @@ workflows:
- postgres-integration-test - postgres-integration-test
- cache-server-test - cache-server-test
filters: *filter-not-release-or-master filters: *filter-not-release-or-master
...@@ -148,7 +148,8 @@ ...@@ -148,7 +148,8 @@
"themes:generate": "ts-node --project ./scripts/cli/tsconfig.json ./scripts/cli/generateSassVariableFiles.ts", "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 run clean && npm run test && lerna version --tag-version-prefix=\"packages@\" -m \"Packages: publish %s\" --no-push",
"packages:build": "lerna run clean && lerna run build", "packages:build": "lerna run clean && lerna run build",
"packages:publish": "lerna publish from-package --contents dist --dist-tag next --tag-version-prefix=\"packages@\"" "packages:publish": "lerna publish from-package --contents dist",
"packages:publishNext": "lerna publish from-package --contents dist --dist-tag next --yes"
}, },
"husky": { "husky": {
"hooks": { "hooks": {
......
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"clean": "rimraf ./dist ./compiled", "clean": "rimraf ./dist ./compiled",
"bundle": "rollup -c rollup.config.ts", "bundle": "rollup -c rollup.config.ts",
"build": "grafana-toolkit package:build --scope=data", "build": "grafana-toolkit package:build --scope=data"
"postpublish": "npm run clean"
}, },
"author": "Grafana Labs", "author": "Grafana Labs",
"license": "Apache-2.0", "license": "Apache-2.0",
...@@ -37,8 +36,5 @@ ...@@ -37,8 +36,5 @@
"rollup-plugin-visualizer": "0.9.2", "rollup-plugin-visualizer": "0.9.2",
"sinon": "1.17.6", "sinon": "1.17.6",
"typescript": "3.4.1" "typescript": "3.4.1"
},
"resolutions": {
"@types/lodash": "4.14.119"
} }
} }
...@@ -11,8 +11,7 @@ ...@@ -11,8 +11,7 @@
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"clean": "rimraf ./dist ./compiled", "clean": "rimraf ./dist ./compiled",
"bundle": "rollup -c rollup.config.ts", "bundle": "rollup -c rollup.config.ts",
"build": "grafana-toolkit package:build --scope=runtime", "build": "grafana-toolkit package:build --scope=runtime"
"postpublish": "npm run clean"
}, },
"author": "Grafana Labs", "author": "Grafana Labs",
"license": "Apache-2.0", "license": "Apache-2.0",
...@@ -33,8 +32,5 @@ ...@@ -33,8 +32,5 @@
"rollup-plugin-typescript2": "0.19.3", "rollup-plugin-typescript2": "0.19.3",
"rollup-plugin-visualizer": "0.9.2", "rollup-plugin-visualizer": "0.9.2",
"typescript": "3.4.1" "typescript": "3.4.1"
},
"resolutions": {
"@types/lodash": "4.14.119"
} }
} }
...@@ -15,8 +15,7 @@ ...@@ -15,8 +15,7 @@
"typecheck": "tsc --noEmit", "typecheck": "tsc --noEmit",
"precommit": "npm run tslint & npm run typecheck", "precommit": "npm run tslint & npm run typecheck",
"clean": "rimraf ./dist ./compiled", "clean": "rimraf ./dist ./compiled",
"build": "grafana-toolkit toolkit:build", "build": "grafana-toolkit toolkit:build"
"postpublish": "npm run clean"
}, },
"author": "Grafana Labs", "author": "Grafana Labs",
"license": "Apache-2.0", "license": "Apache-2.0",
...@@ -75,9 +74,6 @@ ...@@ -75,9 +74,6 @@
"url-loader": "^2.0.1", "url-loader": "^2.0.1",
"webpack": "4.35.0" "webpack": "4.35.0"
}, },
"resolutions": {
"@types/lodash": "4.14.119"
},
"devDependencies": { "devDependencies": {
"@types/glob": "^7.1.1", "@types/glob": "^7.1.1",
"@types/prettier": "^1.16.4" "@types/prettier": "^1.16.4"
......
...@@ -99,4 +99,4 @@ const buildTaskRunner: TaskRunner<PackageBuildOptions> = async ({ scope }) => { ...@@ -99,4 +99,4 @@ const buildTaskRunner: TaskRunner<PackageBuildOptions> = async ({ scope }) => {
await Promise.all(scopes.map(s => s())); await Promise.all(scopes.map(s => s()));
}; };
export const buildPackageTask = new Task<PackageBuildOptions>('@grafana/ui build', buildTaskRunner); export const buildPackageTask = new Task<PackageBuildOptions>('Package build', buildTaskRunner);
...@@ -15,12 +15,12 @@ ...@@ -15,12 +15,12 @@
"storybook:build": "build-storybook -o ./dist/storybook -c .storybook", "storybook:build": "build-storybook -o ./dist/storybook -c .storybook",
"clean": "rimraf ./dist ./compiled", "clean": "rimraf ./dist ./compiled",
"bundle": "rollup -c rollup.config.ts", "bundle": "rollup -c rollup.config.ts",
"build": "grafana-toolkit package:build --scope=ui", "build": "grafana-toolkit package:build --scope=ui"
"postpublish": "npm run clean"
}, },
"author": "Grafana Labs", "author": "Grafana Labs",
"license": "Apache-2.0", "license": "Apache-2.0",
"dependencies": { "dependencies": {
"@grafana/data": "^6.4.0-alpha.8",
"@torkelo/react-select": "2.1.1", "@torkelo/react-select": "2.1.1",
"@types/react-color": "2.17.0", "@types/react-color": "2.17.0",
"classnames": "2.2.6", "classnames": "2.2.6",
...@@ -77,8 +77,5 @@ ...@@ -77,8 +77,5 @@
"rollup-plugin-typescript2": "0.19.3", "rollup-plugin-typescript2": "0.19.3",
"rollup-plugin-visualizer": "0.9.2", "rollup-plugin-visualizer": "0.9.2",
"typescript": "3.4.1" "typescript": "3.4.1"
},
"resolutions": {
"@types/lodash": "4.14.119"
} }
} }
...@@ -29,7 +29,7 @@ export class TableInputCSV extends React.PureComponent<Props, State> { ...@@ -29,7 +29,7 @@ export class TableInputCSV extends React.PureComponent<Props, State> {
}; };
} }
readCSV = debounce(() => { readCSV: any = debounce(() => {
const { config } = this.props; const { config } = this.props;
const { text } = this.state; const { text } = this.state;
......
#!/bin/bash
function parse_git_hash() {
git rev-parse --short HEAD 2> /dev/null | sed "s/\(.*\)/\1/"
}
function prapare_version_commit () {
echo $'\nCommiting version changes. This commit will not be checked-in!'
git config --global user.email "circleci@grafana.com"
git config --global user.name "CirceCI"
git commit -am "Version commit"
}
#Get current version from lerna.json
PACKAGE_VERSION=`grep '"version"' lerna.json | cut -d '"' -f 4`
# Get short current commit's has
GIT_SHA=$(parse_git_hash)
echo "Commit: ${GIT_SHA}"
echo "Current lerna.json version: ${PACKAGE_VERSION}"
# count packages that changed
count=`npx lerna changed --loglevel silent | awk '{c++} END {print c}'`
if [ -z $count ]; then
echo "No changes in packages, skipping packages publishing"
else
echo "Changes detected in ${count} packages"
echo "Releasing packages under ${PACKAGE_VERSION}-${GIT_SHA}"
npx lerna version ${PACKAGE_VERSION}-${GIT_SHA} --no-git-tag-version --no-push --force-publish -y
echo $'\nGit status:'
git status -s
echo $'\nBuilding packages'
yarn packages:build
prapare_version_commit
echo $'\nPublishing packages'
yarn packages:publishNext
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment