Commit 15711ba2 by Dominik Prokop Committed by GitHub

grafana/toolkit: Unpublish previous "next" version when releasing a new one (#18552)

* Unpublish previous canary when releasing a new one

* Update scripts/circle-release-next-packages.sh

* Shellcheck fix
parent e27731bc
#!/bin/bash #!/usr/bin/env bash
function parse_git_hash() { function parse_git_hash() {
git rev-parse --short HEAD 2> /dev/null | sed "s/\(.*\)/\1/" git rev-parse --short HEAD 2> /dev/null | sed "s/\(.*\)/\1/"
...@@ -11,9 +11,20 @@ function prapare_version_commit () { ...@@ -11,9 +11,20 @@ function prapare_version_commit () {
git commit -am "Version commit" git commit -am "Version commit"
} }
#Get current version from lerna.json function unpublish_previous_canary () {
echo $'\nUnpublishing previous canary packages'
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}"
done
}
# Get current version from lerna.json
PACKAGE_VERSION=$(grep '"version"' lerna.json | cut -d '"' -f 4) PACKAGE_VERSION=$(grep '"version"' lerna.json | cut -d '"' -f 4)
# Get short current commit's has # Get current commit's short hash
GIT_SHA=$(parse_git_hash) GIT_SHA=$(parse_git_hash)
echo "Commit: ${GIT_SHA}" echo "Commit: ${GIT_SHA}"
...@@ -31,11 +42,14 @@ else ...@@ -31,11 +42,14 @@ else
echo $'\nGit status:' echo $'\nGit status:'
git status -s git status -s
echo $'\nBuilding packages' echo $'\nBuilding packages'
yarn packages:build yarn packages:build
prapare_version_commit prapare_version_commit
unpublish_previous_canary
echo $'\nPublishing packages' echo $'\nPublishing packages'
yarn packages:publishNext yarn packages:publishNext
fi 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