diff --git a/.github/workflows/cortex-js.yml b/.github/workflows/cortex-js.yml new file mode 100644 index 000000000..31175b1be --- /dev/null +++ b/.github/workflows/cortex-js.yml @@ -0,0 +1,44 @@ +name: Publish cortex js Package to npmjs +on: + push: + tags: ["v[0-9]+.[0-9]+.[0-9]+-cortex-js"] + paths: + [ + "cortex-js/**", + ] +jobs: + build-and-publish-plugins: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: "0" + + - name: Install jq + uses: dcarbone/install-jq-action@v2.0.1 + + - name: "Update version by tag" + run: | + cd cortex-js + # Remove the v prefix + tag_version=${GITHUB_REF#refs/tags/v} + # Remove the -cortex-js suffix + new_version=${tag_version%-cortex-js} + + # Replace the old version with the new version in package.json + jq --arg version "$new_version" '.version = $version' ./package.json > /tmp/package.json && mv /tmp/package.json ./package.json + + # Print the new version + echo "Updated package.json version to: $new_version" + + # Setup .npmrc file to publish to npm + - uses: actions/setup-node@v3 + with: + node-version: "20.x" + registry-url: "https://registry.npmjs.org" + - run: yarn install && yarn build + working-directory: ./cortex-js + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + working-directory: ./cortex-js diff --git a/cortex-js/package.json b/cortex-js/package.json index 3b3989381..f5681e447 100644 --- a/cortex-js/package.json +++ b/cortex-js/package.json @@ -1,5 +1,5 @@ { - "name": "cortex-js", + "name": "@janhq/cortex", "version": "0.0.1", "description": "", "author": "", diff --git a/package.json b/package.json deleted file mode 100644 index a782f0925..000000000 --- a/package.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "@janhq/cortex", - "version": "1.0.0", - "license": "AGPL-3.0", - "scripts": { - "preinstall": "npm pre-install script; platform specific (MacOS / Windows / Linux)", - "dev": "cd cortex-js && yarn start", - "build": "cd cortex-js && yarn build" - }, - "dependencies": { - "express": "^4.17.1", - "typeorm": "^0.2.37", - "pg": "^8.7.1", - "dotenv": "^10.0.0" - }, - "devDependencies": { - "@types/express": "^4.17.13", - "@types/node": "^14.14.33", - "typescript": "^4F3.5" - } -}