Skip to content

Commit ed3f8b4

Browse files
committed
Publish to BW NPM
1 parent 85f0d84 commit ed3f8b4

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

.github/workflows/publish.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Publish to Blockware Public NPM
2+
on:
3+
push:
4+
branches:
5+
- master
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v2
11+
- uses: actions/setup-node@v3
12+
with:
13+
node-version: 18
14+
registry-url: https://registry.npmjs.org/
15+
16+
- id: 'auth'
17+
uses: 'google-github-actions/auth@v1'
18+
with:
19+
credentials_json: '${{ secrets.GCP_ARTIFACTORY_SERVICE_ACCOUNT }}'
20+
21+
- name: 'Set up Cloud SDK'
22+
uses: 'google-github-actions/setup-gcloud@v1'
23+
with:
24+
project_id: ${{ secrets.GCP_PROJECT_ID }}
25+
- run: echo '@blockware:registry=${{ secrets.GCP_ARTIFACT_NPM_URL }}' > .npmrc
26+
- run: npm install
27+
- run: npx google-artifactregistry-auth .npmrc
28+
- run: npm publish --registry ${{ secrets.GCP_ARTIFACT_NPM_URL }}

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class RestClient {
4949
break;
5050
case 'body':
5151
opts.body = JSON.stringify(requestArgument.value);
52-
opts.headers['Content-Type'] = 'application/json';
52+
opts.headers['content-type'] = 'application/json';
5353
break;
5454
case 'query':
5555
query.push(encodeURIComponent(requestArgument.name) + '=' + encodeURIComponent(requestArgument.value));
@@ -58,7 +58,7 @@ class RestClient {
5858
});
5959

6060
if (query.length > 0) {
61-
opts.url += '?' + query.join('&');
61+
url += '?' + query.join('&');
6262
}
6363

6464
const result = await fetch(url, opts);

package-lock.json

Lines changed: 10 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)