diff --git a/.github/workflows/build-npm.yaml b/.github/workflows/build-npm.yaml new file mode 100644 index 000000000..25f68d92b --- /dev/null +++ b/.github/workflows/build-npm.yaml @@ -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 diff --git a/package.json b/package.json index 49b2b9819..0001e83cd 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,6 @@ { "private": true, + "version": "3.9.5", "name": "dbgate-all", "workspaces": [ "packages/*" diff --git a/packages/dbgate/package.json b/packages/dbgate/package.json new file mode 100644 index 000000000..c53c374ae --- /dev/null +++ b/packages/dbgate/package.json @@ -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" + } +} diff --git a/setCurrentVersion.js b/setCurrentVersion.js index 65cebbd5a..689af0b9d 100644 --- a/setCurrentVersion.js +++ b/setCurrentVersion.js @@ -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);