Skip to content

Commit 66ed1b1

Browse files
authored
chore: Add experimental publish (#105) (#111)
Add experimental publish Signed-off-by: Todd Baert <[email protected]>
1 parent b4abd0d commit 66ed1b1

File tree

5 files changed

+66
-55
lines changed

5 files changed

+66
-55
lines changed

.github/workflows/coverage.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Generates baseline code coverage
2+
3+
name: coverage
4+
5+
on:
6+
push:
7+
branches:
8+
- main
9+
10+
jobs:
11+
coverage:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-node@v3
17+
with:
18+
registry-url: 'https://registry.npmjs.org'
19+
20+
- name: Install
21+
run: npm ci
22+
23+
- name: Test
24+
run: npm run test
25+
26+
- name: Upload coverage to Codecov
27+
uses: codecov/codecov-action@v3

.github/workflows/experimental-release.yaml

Lines changed: 0 additions & 53 deletions
This file was deleted.
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Publishes a experimental version if a PR comment includes "/publish".
2+
3+
name: publish-experimental
4+
5+
on:
6+
issue_comment:
7+
types:
8+
- created
9+
10+
jobs:
11+
publish-experimental:
12+
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/publish') }}
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-node@v3
18+
with:
19+
registry-url: 'https://registry.npmjs.org'
20+
21+
- name: Install
22+
run: npm ci
23+
24+
- name: Build
25+
run: npm run build
26+
27+
# create an experimental version at this SHA (vX.X.X-experimental-4742ef14cc0ea07e3569eee56899937452a55a9c)
28+
- name: Version
29+
run: npm version "$(npm run current-version -s)-experimental-$GITHUB_SHA" --no-git-tag-version
30+
31+
- name: Publish
32+
run: npm publish --tag experimental --access public
33+
env:
34+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ Run tests with `npm test`.
3434
### Packaging
3535

3636
Both ES modules and CommonJS modules are supported, so consumers can use both `require` and `import` functions to utilize this module. This is accomplished by building 2 variations of the output, under `dist/esm` and `dist/cjs`, respectively. To force resolution of the `dist/esm/**.js*` files as modules, a package json with only the context `{"type": "module"}` is included at a in a `postbuild` step. Type declarations are included at `/dist/types/`
37+
38+
For testing purposes, you can add a comment containing "/publish" in any PR. This will publish an experimental SDK version with the git SHA appended to the version number.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
"test": "jest --verbose",
1010
"lint": "eslint ./",
1111
"postbuild": "cp ./package.esm.json ./dist/esm/package.json",
12-
"build": "rm -f -R ./dist && tsc --project tsconfig.json && tsc --project tsconfig.cjs.json"
12+
"build": "rm -f -R ./dist && tsc --project tsconfig.json && tsc --project tsconfig.cjs.json",
13+
"current-version": "echo $npm_package_version"
1314
},
1415
"repository": {
1516
"type": "git",
@@ -55,4 +56,4 @@
5556
"typescript": "^4.6.4"
5657
},
5758
"dependencies": {}
58-
}
59+
}

0 commit comments

Comments
 (0)