Build: Publish canary packages to NPM registry (#42922)

* ci(packages): replace canary github publishing with npm registry

* chore(drone): refresh yaml config

* docs(packages): remove github package publish explanation
pull/43020/head
Jack Westbrook 3 years ago committed by GitHub
parent c6483cd8ed
commit da75e4b910
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      .drone.yml
  2. 24
      packages/README.md
  3. 7
      scripts/circle-release-canary-packages.sh
  4. 2
      scripts/drone/steps/lib.star

@ -765,8 +765,8 @@ steps:
- end-to-end-tests-smoke-tests-suite
- end-to-end-tests-various-suite
environment:
GITHUB_PACKAGE_TOKEN:
from_secret: github_package_token
NPM_TOKEN:
from_secret: npm_token
image: grafana/build-container:1.4.8
name: release-canary-npm-packages
- commands:
@ -4109,6 +4109,6 @@ kind: secret
name: prerelease_bucket
---
kind: signature
hmac: b431c3bbdb4778dbed741bb5cd9840f106b4704280751dac4e145754f300a6ea
hmac: e84ccb068a1b18aa34aaee36b44d2372d6c97bac8becd42261661952ca847b0c
...

@ -32,30 +32,6 @@ Every commit to main that has changes within the `packages` directory is a subje
<lerna.json version>-<COMMIT_SHA>
```
Automatic prereleases are published under the `canary` dist tag to the [github package registry](https://docs.github.com/en/free-pro-team@latest/packages/publishing-and-managing-packages/about-github-packages).
#### Consuming prereleases
As mentioned above the `canary` releases are published to the Github package registry rather than the NPM registry. If you wish to make use of these prereleases please follow these steps:
1. You must use a personal access token to install packages from Github. To create an access token [click here](https://github.com/settings/tokens) and create a token with the `read:packages` scope. Make a copy of the token.
2. Create / modify your `~/.npmrc` file with the following:
```
@grafana:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken={INSERT_GH_TOKEN_HERE}
```
3. Update the package.json of your project to use either the `canary` channel or a version of the `canary` channel
```json
// plugin's package.json
{
...
"@grafana/data": "canary"
}
```
### Manual release
> All of the steps below must be performed on a release branch, according to Grafana Release Guide.

@ -13,15 +13,14 @@ function prepare_version_commit () {
# check if there were any changes to packages between current and previous commit
count=$(git diff HEAD~1..HEAD --name-only -- packages | awk '{c++} END {print c}')
count="1"
if [ -z "$count" ]; then
echo "No changes in packages, skipping packages publishing"
else
echo "Changes detected in ${count} packages"
echo "Starting to release latest canary version"
echo "@grafana:registry=https://npm.pkg.github.com" >> ~/.npmrc
echo "//npm.pkg.github.com/:_authToken=${GITHUB_PACKAGE_TOKEN}" >> ~/.npmrc
echo "//registry.npmjs.org/:_authToken=$${NPM_TOKEN}" >> ~/.npmrc
# For some reason the --no-git-reset is not working as described so
# to get lerna to publish the packages we need to do a commit to the
@ -29,6 +28,6 @@ else
prepare_version_commit
echo $'\nPublishing packages'
yarn packages:publishCanary --registry https://npm.pkg.github.com
yarn packages:publishCanary
fi

@ -909,7 +909,7 @@ def release_canary_npm_packages_step(edition):
'end-to-end-tests-various-suite',
],
'environment': {
'GITHUB_PACKAGE_TOKEN': from_secret('github_package_token'),
'NPM_TOKEN': from_secret('npm_token'),
},
'commands': [
'./scripts/circle-release-canary-packages.sh',

Loading…
Cancel
Save