Skip to content

Commit 3191ad8

Browse files
committed
Add CICD
1 parent ad978f7 commit 3191ad8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish cortex js Package to npmjs
2+
on:
3+
push:
4+
tags: ["v[0-9]+.[0-9]+.[0-9]+"]
5+
6+
jobs:
7+
build-and-publish-plugins:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
with:
12+
fetch-depth: "0"
13+
14+
- name: Install jq
15+
uses: dcarbone/install-jq-action@v2.0.1
16+
17+
- name: "Update version by tag"
18+
run: |
19+
cd cortex-js
20+
# Remove the v prefix
21+
new_version=${GITHUB_REF#refs/tags/v}
22+
23+
# Replace the old version with the new version in package.json
24+
jq --arg version "$new_version" '.version = $version' ./package.json > /tmp/package.json && mv /tmp/package.json ./package.json
25+
26+
# Print the new version
27+
echo "Updated package.json version to: $new_version"
28+
29+
# Setup .npmrc file to publish to npm
30+
- uses: actions/setup-node@v3
31+
with:
32+
node-version: "20.x"
33+
registry-url: "https://registry.npmjs.org"
34+
- run: yarn install && yarn build
35+
- run: yarn publish --access public
36+
env:
37+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)