NPM: Publish canary packages (#110866)
* publish npm canaries use build artifact instead log tweak * try and fix path * k fix correct path to packages * improve error handling in npm script * install specific npm version * restore rest of release workflow * fix bits * fix newline that didn't newline * remove unused exit_if_fail
This commit is contained in:
@@ -5,9 +5,6 @@
|
||||
dist_tag="canary"
|
||||
registry="http://localhost:4873"
|
||||
|
||||
# shellcheck source=./scripts/helpers/exit-if-fail.sh
|
||||
source "$(dirname "$0")/helpers/exit-if-fail.sh"
|
||||
|
||||
if [ -z "$NPM_TOKEN" ]; then
|
||||
echo "The NPM_TOKEN environment variable does not exist."
|
||||
exit 1
|
||||
@@ -34,17 +31,31 @@ while [[ $# -gt 0 ]]; do
|
||||
esac
|
||||
done
|
||||
|
||||
echo "Starting to release $dist_tag version"
|
||||
echo "Starting to release $dist_tag version with NPM version $(npm --version) to registry $registry"
|
||||
|
||||
registry_without_protocol=${registry#*:}
|
||||
|
||||
echo "$registry_without_protocol/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
|
||||
if [[ "$NPM_TOKEN" != "oidc" ]]; then
|
||||
registry_without_protocol=${registry#*:}
|
||||
echo "$registry_without_protocol/:_authToken=${NPM_TOKEN}" >> ~/.npmrc
|
||||
fi
|
||||
|
||||
# Loop over .tar files in directory and publish them to npm registry
|
||||
failed_packages=()
|
||||
for file in ./npm-artifacts/*.tgz; do
|
||||
npm publish "$file" --tag "$dist_tag" --registry "$registry"
|
||||
if ! npm publish "$file" --tag "$dist_tag" --registry "$registry"; then
|
||||
failed_packages+=("$file")
|
||||
fi
|
||||
done
|
||||
|
||||
# Log failed packages and exit with error if any failed
|
||||
if (( ${#failed_packages[@]} > 0 )); then
|
||||
echo ""
|
||||
echo "ERROR: The following packages failed to publish:"
|
||||
for pkg in "${failed_packages[@]}"; do
|
||||
echo " - $pkg"
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if any files in packages/grafana-e2e-selectors were changed. If so, add a 'modified' tag to the package
|
||||
CHANGES_COUNT=$(git diff HEAD~1..HEAD --name-only -- packages/grafana-e2e-selectors | awk 'END{print NR}')
|
||||
if (( CHANGES_COUNT > 0 )); then
|
||||
|
||||
Reference in New Issue
Block a user