set current version

This commit is contained in:
Jan Prochazka
2021-02-07 09:56:50 +01:00
parent 2aa965cf3b
commit 6b06ed5baf
4 changed files with 94 additions and 1 deletions

46
.github/workflows/build-npm.yaml vendored Normal file
View File

@@ -0,0 +1,46 @@
name: Docker image
# on: [push]
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
# - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
# on:
# push:
# branches:
# - production
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04]
# os: [macOS-10.14, windows-2016, ubuntu-18.04]
steps:
- name: Context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
run: echo "$GITHUB_CONTEXT"
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Use Node.js 10.x
uses: actions/setup-node@v1
with:
node-version: 10.x
- name: yarn install
run: |
yarn install
- name: setCurrentVersion
run: |
yarn setCurrentVersion
- name: Prepare docker image
run: |
yarn run prepare:docker

View File

@@ -1,5 +1,6 @@
{
"private": true,
"version": "3.9.5",
"name": "dbgate-all",
"workspaces": [
"packages/*"

View File

@@ -0,0 +1,21 @@
{
"name": "dbgate",
"version": "1.0.7",
"homepage": "https://dbgate.org/",
"repository": {
"type": "git",
"url": "https://github.com/dbshell/dbgate.git"
},
"funding": "https://www.paypal.com/paypalme/JanProchazkaCz/30eur",
"author": "Jan Prochazka",
"license": "MIT",
"keywords": [
"sql",
"dbgate",
"web"
],
"dependencies": {
"dbgate-api": "3.9.5",
"dbgate-web": "3.9.5"
}
}

View File

@@ -1,5 +1,23 @@
const fs = require('fs');
const packageJson = fs.readFileSync('app/package.json', { encoding: 'utf-8' });
const path = require('path');
function changeDependencies(deps, version) {
if (!deps) return;
for (const key of Object.keys(deps)) {
if (key.startsWith('dbate-')) deps[key] = version;
}
}
function changePackageFile(path, version) {
const text = fs.readFileSync(path.join(path, 'package.json'), { encoding: 'utf-8' });
const json = JSON.parse(packageJson);
json.version = version;
changeDependencies(json.dependencies, version);
changeDependencies(json.devDependencies, version);
fs.writeFileSync(path.join(path, 'package.json'), JSON.stringify(json, null, 2), { encoding: 'utf-8' });
}
const packageJson = fs.readFileSync('package.json', { encoding: 'utf-8' });
const json = JSON.parse(packageJson);
const text = `
@@ -10,3 +28,10 @@ module.exports = {
`;
fs.writeFileSync('packages/api/src/currentVersion.js', text);
changePackageFile('app', json.version);
changePackageFile('packages/api', json.version);
changePackageFile('packages/sqltree', json.version);
changePackageFile('packages/types', json.version);
changePackageFile('packages/tools', json.version);
changePackageFile('packages/web', json.version);