Skip to content

Commit 30a39fa

Browse files
committed
fixup
1 parent b2cf004 commit 30a39fa

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

ci/steps/publish-npm.sh

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
#!/usr/bin/env bash
22
set -euo pipefail
33

4-
# TODOs refactor this to determine ENVIRONMENT, NPM_TAG and NPM_VERSION
5-
64
main() {
75
cd "$(dirname "$0")/../.."
86
source ./ci/lib.sh
@@ -49,19 +47,17 @@ main() {
4947
exit 1
5048
fi
5149

52-
# We need TAG to know what to publish under on npm
53-
# Options are "latest", "beta", or "<pr number >"
54-
# See Environment comments above to know when each is used.
55-
# TODO@jsjoeio - we need to determine this ourselves
56-
if ! is_env_var_set "NPM_TAG"; then
57-
echo "NPM_TAG is not set. This is needed for tagging the npm release."
50+
# We use this to grab the PR_NUMBER
51+
if ! is_env_var_set "GITHUB_REF"; then
52+
echo "GITHUB_REF is not set. Are you running this locally? We rely on values provided by GitHub."
5853
exit 1
5954
fi
6055

61-
#TODO@jsjoeio check for these values from GITHUB
62-
# GITHUB_REF GITHUB_SHA
63-
64-
echo "using tag: $NPM_TAG"
56+
# We use this when setting NPM_VERSION
57+
if ! is_env_var_set "GITHUB_SHA"; then
58+
echo "GITHUB_SHA is not set. Are you running this locally? We rely on values provided by GitHub."
59+
exit 1
60+
fi
6561

6662
# This allows us to publish to npm in CI workflows
6763
if [[ ${CI-} ]]; then
@@ -95,9 +91,6 @@ main() {
9591
echo "Found environment: $ENVIRONMENT"
9692
echo "Manually bumping npm version..."
9793

98-
# TODO@jsjoeio we need to add logic here which determines the NPM_VERSION
99-
# in development, use PR_NUMBER and COMMIT_SHA
100-
# otherwise in staging use NPM_TAG and and COMMIT_SAH
10194
if [[ "$ENVIRONMENT" == "beta" ]]; then
10295
NPM_VERSION="$VERSION-beta-$COMMIT_SHA"
10396
# This means the npm version will be tagged with "beta"
@@ -114,6 +107,8 @@ main() {
114107
NPM_TAG="$PR_NUMBER"
115108
fi
116109

110+
echo "using tag: $NPM_TAG"
111+
117112
# We modify the version in the package.json
118113
# to be the current version + the PR number + commit SHA
119114
# or we use current version + beta + commit SHA

0 commit comments

Comments
 (0)