File tree 5 files changed +11
-59
lines changed
5 files changed +11
-59
lines changed Original file line number Diff line number Diff line change @@ -191,6 +191,11 @@ jobs:
191
191
- name : Run ./ci/steps/publish-npm.sh
192
192
run : yarn publish:npm
193
193
env :
194
+ # The way this logic works is it checks if the GitHub event is a push to the `main` branch
195
+ # if so, we're in the staging environment (i.e. running in CI on merge into `main`)
196
+ # otherwise it's running in CI on a PR event, meaning development environment
197
+ # Source: https://kevsoft.net/2020/06/10/running-github-action-steps-and-jobs-only-on-push-to-master.html
198
+ ENVIRONMENT : ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && "staging" || "development" }}
194
199
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
195
200
NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
196
201
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 19
19
- name : Publish npm package and tag with "latest"
20
20
run : yarn publish:npm
21
21
env :
22
+ ENVIRONMENT : " production"
22
23
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
23
24
NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
24
25
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ main() {
52
52
# We need TAG to know what to publish under on npm
53
53
# Options are "latest", "beta", or "<pr number >"
54
54
# See Environment comments above to know when each is used.
55
+ # TODO@jsjoeio - we need to determine this ourselves
55
56
if ! is_env_var_set " NPM_TAG" ; then
56
57
echo " NPM_TAG is not set. This is needed for tagging the npm release."
57
58
exit 1
@@ -64,6 +65,10 @@ main() {
64
65
echo " //registry.npmjs.org/:_authToken=${NPM_TOKEN} " > ~ /.npmrc
65
66
fi
66
67
68
+ # TODO@jsjoeio we need to refactor to download this based on environment
69
+ # for "development", use the branch artifacts
70
+ # for "staging" (merges into main),
71
+ # for "production" look for release branch (currently we do this)
67
72
download_artifact npm-package ./release-npm-package
68
73
# https://github.com/actions/upload-artifact/issues/38
69
74
tar -xzf release-npm-package/package.tar.gz
You can’t perform that action at this time.
0 commit comments