Browse Source

chore(action): add npm release action

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/559/head
Pranav C 3 years ago
parent
commit
9b25d92e26
  1. 54
      .github/workflows/release-npm.yml
  2. 2
      packages/nocodb/package-lock.json
  3. 2
      packages/nocodb/package.json
  4. 15
      scripts/upgradeNcGui.js

54
.github/workflows/release-npm.yml

@ -0,0 +1,54 @@
name: "Release : NPM packages"
on:
workflow_dispatch:
inputs:
version:
description: "NocoDB package tag"
required: true
jobs:
release:
runs-on: ubuntu-latest
env:
working-directory: ./packages/nocodb
strategy:
matrix:
node-version: [12]
steps:
- uses: actions/checkout@v2
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v2
with:
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
- run: |
cd packages/nc-gui
npm install
npm run build:copy:jsdeliver
cd ../..
npm install
VERSION=${{github.event.inputs.version}} node scripts/upgradeNcGui.js node scripts/upgradeNcGui.js && cd packages/nocodb && npm run obfuscate:build:publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# commit-message: Update report
# committer: GitHub <noreply@github.com>
# author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: true
branch: release-patches
delete-branch: true
title: 'Release ${{github.event.inputs.tag}}'
labels: |
release
automated pr
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

2
packages/nocodb/package-lock.json generated

@ -1,6 +1,6 @@
{ {
"name": "nocodb", "name": "nocodb",
"version": "0.11.35", "version": "0.11.36",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

2
packages/nocodb/package.json

@ -147,7 +147,7 @@
"nanoid": "^3.1.20", "nanoid": "^3.1.20",
"nc-common": "0.0.6", "nc-common": "0.0.6",
"nc-help": "^0.2.14", "nc-help": "^0.2.14",
"nc-lib-gui": "^0.2.55", "nc-lib-gui": "0.2.55",
"nc-plugin": "^0.1.1", "nc-plugin": "^0.1.1",
"ncp": "^2.0.0", "ncp": "^2.0.0",
"nodemailer": "^6.4.10", "nodemailer": "^6.4.10",

15
scripts/upgradeNcGui.js

@ -0,0 +1,15 @@
const fs = require('fs')
const path = require('path')
const execSync = require('child_process').execSync;
// extract latest version from package.json
const ncLibPackage = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'packages', 'nc-lib-gui', 'package.json')))
// upgrade nc-lib-gui version in nocodb
execSync(`cd packages/nocodb && npm install --save --save-exact nc-lib-gui@${ncLibPackage.version}`, {});
const nocodbPackageFilePath = path.join(__dirname, '..', 'packages', 'nocodb', 'package.json')
const nocoLibPackage = JSON.parse(fs.readFileSync(nocodbPackageFilePath))
nocoLibPackage.version = process.env.VERSION;
fs.writeFileSync(nocodbPackageFilePath, JSON.stringify(nocoLibPackage, null, 2));
Loading…
Cancel
Save