Skip to content

Commit 2704db1

Browse files
committed
feat: add script to publish-npm-dev
1 parent d775c88 commit 2704db1

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

.github/workflows/ci.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,12 @@ jobs:
177177
name: npm-package
178178
path: ./package.tar.gz
179179

180+
- name: Publish npm package with dev tag
181+
run: yarn publish:npm:dev
182+
env:
183+
TAG: ${{ github.event.number }}-${{ github.event.pull_request.head.sha }}
184+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
185+
180186
# TODO: cache building yarn --production
181187
# possibly 2m30s of savings(?)
182188
# this requires refactoring our release scripts

ci/steps/publish-npm-dev.sh

+12-3
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@
22
set -euo pipefail
33

44
main() {
5-
# We need VERSION to bump the brew formula
5+
cd "$(dirname "$0")/../.."
6+
source ./ci/lib.sh
7+
source ./ci/steps/steps-lib.sh
8+
9+
# We need TAG to know what to publish under on npm
610
if ! is_env_var_set "TAG"; then
711
echo "TAG is not set. Cannot publish to npm without setting a tag"
812
exit 1
913
fi
10-
cd "$(dirname "$0")/../.."
11-
source ./ci/lib.sh
14+
15+
if ! is_env_var_set "NPM_TOKEN"; then
16+
echo "TAG is not set. Cannot publish to npm without setting a tag"
17+
exit 1
18+
fi
19+
20+
echo "using tag: $TAG"
1221

1322
if [[ ${CI-} ]]; then
1423
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"test:scripts": "./ci/dev/test-scripts.sh",
2424
"package": "./ci/build/build-packages.sh",
2525
"postinstall": "./ci/dev/postinstall.sh",
26+
"publish:npm:dev": "./ci/steps/publish-npm-dev.sh",
2627
"_audit": "./ci/dev/audit.sh",
2728
"fmt": "./ci/dev/fmt.sh",
2829
"lint": "./ci/dev/lint.sh",

0 commit comments

Comments
 (0)