Skip to content

Commit b4c332c

Browse files
committed
Add CI workflow for Node.js and publish package to npm
1 parent d7a5224 commit b4c332c

File tree

4 files changed

+40
-62
lines changed

4 files changed

+40
-62
lines changed
File renamed without changes.

.github/workflows/npmpublish.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/publish.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Publish Package to npmjs
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
# Setup .npmrc file to publish to npm
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: '20.x'
19+
registry-url: 'https://registry.npmjs.org'
20+
- run: |
21+
npm ci
22+
npm run build
23+
# print the NPM user name for validation
24+
npm whoami
25+
VERSION=$(node -p "require('./package.json').version" )
26+
# Only publish stable versions to the latest tag
27+
if [[ "$VERSION" =~ ^[^-]+$ ]]; then
28+
NPM_TAG="latest"
29+
else
30+
NPM_TAG="beta"
31+
fi
32+
echo "Publishing $VERSION with $NPM_TAG tag."
33+
npm publish --tag $NPM_TAG --provenance --access public
34+
env:
35+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
36+
CI: true

package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@
1212
"build": "vite build",
1313
"type-check": "vue-tsc --build"
1414
},
15+
"repository": {
16+
"type": "git",
17+
"url": "https://github.com/imagekit-developer/imagekit-vuejs"
18+
},
1519
"peerDependencies": {
1620
"vue": ">=3.0.0"
1721
},

0 commit comments

Comments
 (0)