Commit c2e81ab1 by Jack Westbrook Committed by GitHub

Build: Publish next and latest npm channels to Github (#29615)

* build(npm): publish next and latest packages to github registry

* ci(release): remove redundant commands from release-npm-packages step

* Update scripts/release.star

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>

* Update scripts/release.star

Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
Co-authored-by: Arve Knudsen <arve.knudsen@gmail.com>
parent 9508656b
...@@ -949,8 +949,6 @@ steps: ...@@ -949,8 +949,6 @@ steps:
- name: release-npm-packages - name: release-npm-packages
image: grafana/build-container:1.3.0 image: grafana/build-container:1.3.0
commands: commands:
- ./node_modules/.bin/lerna bootstrap
- echo "//registry.npmjs.org/:_authToken=$${NPM_TOKEN}" >> ~/.npmrc
- ./scripts/build/release-packages.sh ${DRONE_TAG} - ./scripts/build/release-packages.sh ${DRONE_TAG}
environment: environment:
NPM_TOKEN: NPM_TOKEN:
...@@ -1730,9 +1728,6 @@ steps: ...@@ -1730,9 +1728,6 @@ steps:
- name: release-npm-packages - name: release-npm-packages
image: grafana/build-container:1.3.0 image: grafana/build-container:1.3.0
commands:
- ./node_modules/.bin/lerna bootstrap
- echo "//registry.npmjs.org/:_authToken=$${NPM_TOKEN}" >> ~/.npmrc
environment: environment:
NPM_TOKEN: NPM_TOKEN:
from_secret: npm_token from_secret: npm_token
......
...@@ -36,10 +36,13 @@ else ...@@ -36,10 +36,13 @@ else
exit exit
fi fi
# Publish to NPM registry
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
echo $'\nBuilding packages' echo $'\nBuilding packages'
yarn packages:build yarn packages:build
echo $'\nPublishing packages' echo $'\nPublishing packages to NPM registry'
yarn packages:${SCRIPT} yarn packages:${SCRIPT}
# When releasing stable(latest) version of packages we are updating previously published next tag(beta) to be the same version as latest # When releasing stable(latest) version of packages we are updating previously published next tag(beta) to be the same version as latest
...@@ -50,3 +53,22 @@ if [ $RELEASE_CHANNEL == "latest" ]; then ...@@ -50,3 +53,22 @@ if [ $RELEASE_CHANNEL == "latest" ]; then
npm dist-tag add "$i"@"$PACKAGE_VERSION" next npm dist-tag add "$i"@"$PACKAGE_VERSION" next
done done
fi fi
# Publish to Github Packages registry
# We do this for the convenience of developers that make use of both the canary and next / latest channels.
echo "@grafana:registry=https://npm.pkg.github.com" >> ~/.npmrc
echo "//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGE_TOKEN}" >> ~/.npmrc
echo $'\nPublishing packages to Github Packages registry'
yarn packages:${SCRIPT} --registry https://npm.pkg.github.com
# When releasing stable(latest) version of packages we are updating previously published next tag(beta) to be the same version as latest
if [ $RELEASE_CHANNEL == "latest" ]; then
for i in "${PACKAGES[@]}"
do
:
npm dist-tag add "$i"@"$PACKAGE_VERSION" next
done
fi
...@@ -35,12 +35,10 @@ def release_npm_packages_step(edition, ver_mode): ...@@ -35,12 +35,10 @@ def release_npm_packages_step(edition, ver_mode):
if edition == 'enterprise': if edition == 'enterprise':
return None return None
commands = [
'./node_modules/.bin/lerna bootstrap',
'echo "//registry.npmjs.org/:_authToken=$${NPM_TOKEN}" >> ~/.npmrc',
]
if ver_mode == 'release': if ver_mode == 'release':
commands.append('./scripts/build/release-packages.sh ${DRONE_TAG}') commands = ['./scripts/build/release-packages.sh ${DRONE_TAG}']
else:
commands = []
return { return {
'name': 'release-npm-packages', 'name': 'release-npm-packages',
......
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