grafana/scripts/circle-release-canary-packages.sh
Ashley Harrison a344c88a01
Chore: don't create the npm-artifacts dir since yarn packages:pack does this… (#62246)
* don't create the npm-artifacts dir since yarn packages:pack does this already

* fix an any to trigger a canary build
2023-01-26 16:41:08 +00:00

25 lines
733 B
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
# shellcheck source=./scripts/helpers/exit-if-fail.sh
source "$(dirname "$0")/helpers/exit-if-fail.sh"
# 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}')
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 "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
echo $'\nPacking packages'
yarn packages:pack
echo $'\nPublishing packages'
for file in ./npm-artifacts/*.tgz; do npm publish "$file" --tag canary; done
fi