Skip to content

Commit d2e6ab2

Browse files
committed
refactor: delete npm-beta and npm-dev workflows
1 parent e6ceacf commit d2e6ab2

File tree

5 files changed

+11
-59
lines changed

5 files changed

+11
-59
lines changed

.github/workflows/ci.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,11 @@ jobs:
191191
- name: Run ./ci/steps/publish-npm.sh
192192
run: yarn publish:npm
193193
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" }}
194199
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
195200
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
196201

.github/workflows/npm-beta.yaml

-29
This file was deleted.

.github/workflows/npm-brew.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
- name: Publish npm package and tag with "latest"
2020
run: yarn publish:npm
2121
env:
22+
ENVIRONMENT: "production"
2223
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2324
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2425

.github/workflows/npm-dev.yaml

-30
This file was deleted.

ci/steps/publish-npm.sh

+5
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ main() {
5252
# We need TAG to know what to publish under on npm
5353
# Options are "latest", "beta", or "<pr number >"
5454
# See Environment comments above to know when each is used.
55+
# TODO@jsjoeio - we need to determine this ourselves
5556
if ! is_env_var_set "NPM_TAG"; then
5657
echo "NPM_TAG is not set. This is needed for tagging the npm release."
5758
exit 1
@@ -64,6 +65,10 @@ main() {
6465
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
6566
fi
6667

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)
6772
download_artifact npm-package ./release-npm-package
6873
# https://github.com/actions/upload-artifact/issues/38
6974
tar -xzf release-npm-package/package.tar.gz

0 commit comments

Comments
 (0)