Skip to content

Commit 7f0085e

Browse files
authored
Merge pull request #23 from optimizely/anwar/EHS-50
[EHS-50] Add gh actions for publishing the package to jfrog
2 parents 24253ca + 60232b2 commit 7f0085e

2 files changed

Lines changed: 50 additions & 2 deletions

File tree

.github/workflows/ci.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'Version to publish (e.g., 1.0.0)'
13+
required: true
14+
type: string
15+
16+
jobs:
17+
build:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/setup-node@v4
22+
with:
23+
node-version: 8.x
24+
- run: yarn install
25+
- run: yarn build
26+
27+
publish:
28+
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
29+
runs-on: ubuntu-latest
30+
steps:
31+
- uses: actions/checkout@v4
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version: 8.x
35+
- run: npm config set registry ${{ secrets.NPM_REGISTRY_URL }}
36+
- run: yarn install
37+
- name: Set version
38+
if: github.event_name == 'workflow_dispatch'
39+
run: npm version ${{ github.event.inputs.version }} --no-git-tag-version
40+
- run: yarn build
41+
- run: yarn publish --non-interactive
42+
env:
43+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

src/fns.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,13 @@ function extractQueryParams(path) {
3636
* @return {String}
3737
*/
3838
function extractPath(base, canonicalPath) {
39-
let path = canonicalPath?.replace(base, '') || '/'
40-
let qsIndex = path.indexOf('?')
39+
let path = '/';
40+
41+
if (canonicalPath != null && typeof canonicalPath === 'string') {
42+
path = canonicalPath.replace(base, '') || '/';
43+
}
44+
45+
let qsIndex = path.indexOf('?');
4146
return (qsIndex > -1) ? path.slice(0, qsIndex) : path
4247
}
4348

0 commit comments

Comments
 (0)