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:
echo "-- no changes to docs files --"
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:
version: 2
build-master:
......@@ -694,6 +709,11 @@ workflows:
requires:
- end-to-end-test
filters: *filter-only-master
- release-next-packages:
requires:
- build-all
- test-frontend
filters: *filter-only-master
release:
jobs:
- build-all:
......@@ -803,3 +823,4 @@ workflows:
- postgres-integration-test
- cache-server-test
filters: *filter-not-release-or-master
......@@ -148,7 +148,8 @@
"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: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": {
"hooks": {
......
......@@ -11,8 +11,7 @@
"typecheck": "tsc --noEmit",
"clean": "rimraf ./dist ./compiled",
"bundle": "rollup -c rollup.config.ts",
"build": "grafana-toolkit package:build --scope=data",
"postpublish": "npm run clean"
"build": "grafana-toolkit package:build --scope=data"
},
"author": "Grafana Labs",
"license": "Apache-2.0",
......@@ -37,8 +36,5 @@
"rollup-plugin-visualizer": "0.9.2",
"sinon": "1.17.6",
"typescript": "3.4.1"
},
"resolutions": {
"@types/lodash": "4.14.119"
}
}
......@@ -11,8 +11,7 @@
"typecheck": "tsc --noEmit",
"clean": "rimraf ./dist ./compiled",
"bundle": "rollup -c rollup.config.ts",
"build": "grafana-toolkit package:build --scope=runtime",
"postpublish": "npm run clean"
"build": "grafana-toolkit package:build --scope=runtime"
},
"author": "Grafana Labs",
"license": "Apache-2.0",
......@@ -33,8 +32,5 @@
"rollup-plugin-typescript2": "0.19.3",
"rollup-plugin-visualizer": "0.9.2",
"typescript": "3.4.1"
},
"resolutions": {
"@types/lodash": "4.14.119"
}
}
......@@ -15,8 +15,7 @@
"typecheck": "tsc --noEmit",
"precommit": "npm run tslint & npm run typecheck",
"clean": "rimraf ./dist ./compiled",
"build": "grafana-toolkit toolkit:build",
"postpublish": "npm run clean"
"build": "grafana-toolkit toolkit:build"
},
"author": "Grafana Labs",
"license": "Apache-2.0",
......@@ -75,9 +74,6 @@
"url-loader": "^2.0.1",
"webpack": "4.35.0"
},
"resolutions": {
"@types/lodash": "4.14.119"
},
"devDependencies": {
"@types/glob": "^7.1.1",
"@types/prettier": "^1.16.4"
......
......@@ -99,4 +99,4 @@ const buildTaskRunner: TaskRunner<PackageBuildOptions> = async ({ scope }) => {
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 @@
"storybook:build": "build-storybook -o ./dist/storybook -c .storybook",
"clean": "rimraf ./dist ./compiled",
"bundle": "rollup -c rollup.config.ts",
"build": "grafana-toolkit package:build --scope=ui",
"postpublish": "npm run clean"
"build": "grafana-toolkit package:build --scope=ui"
},
"author": "Grafana Labs",
"license": "Apache-2.0",
"dependencies": {
"@grafana/data": "^6.4.0-alpha.8",
"@torkelo/react-select": "2.1.1",
"@types/react-color": "2.17.0",
"classnames": "2.2.6",
......@@ -77,8 +77,5 @@
"rollup-plugin-typescript2": "0.19.3",
"rollup-plugin-visualizer": "0.9.2",
"typescript": "3.4.1"
},
"resolutions": {
"@types/lodash": "4.14.119"
}
}
......@@ -29,7 +29,7 @@ export class TableInputCSV extends React.PureComponent<Props, State> {
};
}
readCSV = debounce(() => {
readCSV: any = debounce(() => {
const { config } = this.props;
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