@@ -58,6 +58,9 @@ main() {
58
58
exit 1
59
59
fi
60
60
61
+ # TODO@jsjoeio check for these values from GITHUB
62
+ # GITHUB_REF GITHUB_SHA
63
+
61
64
echo " using tag: $NPM_TAG "
62
65
63
66
# This allows us to publish to npm in CI workflows
@@ -83,20 +86,39 @@ main() {
83
86
# in the package.json and we commit it as part of the release PR.
84
87
if [[ " $ENVIRONMENT " == " production" ]]; then
85
88
NPM_VERSION=" $VERSION "
89
+ # This means the npm version will be published as "stable"
90
+ # and installed when a user runs `yarn install code-server`
91
+ NPM_TAG=" latest"
86
92
else
93
+ COMMIT_SHA=" $GITHUB_SHA "
87
94
echo " Not a production environment"
88
95
echo " Found environment: $ENVIRONMENT "
89
96
echo " Manually bumping npm version..."
90
97
91
- if ! is_env_var_set " PR_NUMBER_AND_COMMIT_SHA" ; then
92
- echo " PR_NUMBER_AND_COMMIT_SHA is not set. This is needed for setting the npm version in non-production environments."
93
- exit 1
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
101
+ if [[ " $ENVIRONMENT " == " beta" ]]; then
102
+ NPM_VERSION=" $VERSION -beta-$COMMIT_SHA "
103
+ # This means the npm version will be tagged with "beta"
104
+ # and installed when a user runs `yarn install code-server@beta`
105
+ NPM_TAG=" beta"
106
+ fi
107
+
108
+ if [[ " $ENVIRONMENT " == " development" ]]; then
109
+ # Source: https://github.com/actions/checkout/issues/58#issuecomment-614041550
110
+ PR_NUMBER=$( echo $GITHUB_REF | awk ' BEGIN { FS = "/" } ; { print $3 }' )
111
+ NPM_VERSION=" $VERSION -$PR_NUMBER -$COMMIT_SHA "
112
+ # This means the npm version will be tagged with "<pr number>"
113
+ # and installed when a user runs `yarn install code-server@<pr number>`
114
+ NPM_TAG=" $PR_NUMBER "
94
115
fi
95
116
96
117
# We modify the version in the package.json
97
118
# to be the current version + the PR number + commit SHA
119
+ # or we use current version + beta + commit SHA
98
120
# Example: "version": "4.0.1-4769-ad7b23cfe6ffd72914e34781ef7721b129a23040"
99
- NPM_VERSION= " $VERSION - $PR_NUMBER_AND_COMMIT_SHA "
121
+ # Example: "version": "4.0.1-beta-ad7b23cfe6ffd72914e34781ef7721b129a23040 "
100
122
pushd release
101
123
# NOTE:@jsjoeio
102
124
# I originally tried to use `yarn version` but ran into issues and abandoned it.
0 commit comments