Skip to content

Commit 8145862

Browse files
Merge pull request #10 from Rakshitha-D/workflows
#SBCOSS-524: workflow to publish package to npm
2 parents 13ae5ae + 588d5da commit 8145862

2 files changed

Lines changed: 49 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish File Upload Library Package
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '22.15.0'
19+
cache: 'npm'
20+
21+
- name: Restore node_modules cache
22+
id: cache
23+
uses: actions/cache@v4
24+
with:
25+
path: node_modules
26+
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
27+
restore-keys: |
28+
${{ runner.os }}-node-modules-
29+
30+
- name: Install dependencies
31+
run: npm ci
32+
33+
- name: Save node_modules cache
34+
if: steps.cache.outputs.cache-hit != 'true'
35+
uses: actions/cache@v4
36+
with:
37+
path: node_modules
38+
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
39+
40+
- name: Build and publish package
41+
env:
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
run: |
44+
npm run build
45+
cp package.json ./dist/package.json
46+
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
47+
npm publish dist --access=public
48+

.github/workflows/pull_request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Code Quality Checks
22

33
on:
4-
push:
4+
pull_request:
55
branches:
66
- '**'
77

0 commit comments

Comments
 (0)