From fd2d2e90d41c1f1bc3ecfa3558f02b092688ecf1 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Fri, 27 Dec 2024 08:34:17 +0100 Subject: [PATCH 01/15] workflow refactor WIP --- common/processWorkflows.js | 42 +++++ workflow-templates/build-app-beta.yaml | 133 ++++++++++++++++ workflow-templates/build-app-pro-beta.yaml | 160 +++++++++++++++++++ workflow-templates/build-app-pro.yaml | 153 ++++++++++++++++++ workflow-templates/build-app.yaml | 175 +++++++++++++++++++++ workflow-templates/build-aws-pro-beta.yaml | 148 +++++++++++++++++ workflow-templates/build-docker-pro.yaml | 110 +++++++++++++ workflow-templates/build-docker.tpl.yaml | 132 ++++++++++++++++ workflow-templates/build-docker.yaml | 106 +++++++++++++ workflow-templates/build-npm-pro.yaml | 119 ++++++++++++++ workflow-templates/build-npm.yaml | 156 ++++++++++++++++++ workflow-templates/includes.tpl.yaml | 22 +++ workflow-templates/run-tests.yaml | 104 ++++++++++++ 13 files changed, 1560 insertions(+) create mode 100644 common/processWorkflows.js create mode 100644 workflow-templates/build-app-beta.yaml create mode 100644 workflow-templates/build-app-pro-beta.yaml create mode 100644 workflow-templates/build-app-pro.yaml create mode 100644 workflow-templates/build-app.yaml create mode 100644 workflow-templates/build-aws-pro-beta.yaml create mode 100644 workflow-templates/build-docker-pro.yaml create mode 100644 workflow-templates/build-docker.tpl.yaml create mode 100644 workflow-templates/build-docker.yaml create mode 100644 workflow-templates/build-npm-pro.yaml create mode 100644 workflow-templates/build-npm.yaml create mode 100644 workflow-templates/includes.tpl.yaml create mode 100644 workflow-templates/run-tests.yaml diff --git a/common/processWorkflows.js b/common/processWorkflows.js new file mode 100644 index 000000000..8fc2c7350 --- /dev/null +++ b/common/processWorkflows.js @@ -0,0 +1,42 @@ +const fs = require('fs'); +const path = require('path'); +const yaml = require('js-yaml'); + +const indir = path.resolve(path.join(__dirname, '..', 'workflow-templates')); +const outdir = path.resolve(path.join(__dirname, '..', 'workflow-templates')); + +const includes = {}; + +for (const file of fs.readdirSync(indir)) { + const text = fs.readFileSync(path.join(indir, file), { encoding: 'utf-8' }); + const json = yaml.load(text); + if (json._module) { + for (const key in json) { + if (key === '_module') { + continue; + } + includes[key] = json[key]; + } + } +} + +for (const file of fs.readdirSync(indir)) { + const text = fs.readFileSync(path.join(indir, file), { encoding: 'utf-8' }); + const json = yaml.load(text); + + if (json._module) { + continue; + } + + if (json._templates) { + for (const template of json._templates) { + const outfile = template.file; + const text = template.text; + const json = template.json; + const out = path.join(outdir, name); + fs.writeFileSync(out, text); + } + + + } +} diff --git a/workflow-templates/build-app-beta.yaml b/workflow-templates/build-app-beta.yaml new file mode 100644 index 000000000..7b7fd078c --- /dev/null +++ b/workflow-templates/build-app-beta.yaml @@ -0,0 +1,133 @@ +name: Electron app BETA + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: [macos-14, windows-2022, ubuntu-22.04] + # os: [macOS-10.15] + + steps: + - name: Install python 3.11 (MacOS) + if: matrix.os == 'macos-14' + run: | + brew install python@3.11 + echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV + - name: Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Use Node.js 22.x + uses: actions/setup-node@v1 + with: + node-version: 22.x + - name: adjustPackageJson + run: | + node adjustPackageJson --community + - name: setUpdaterChannel beta + run: | + node setUpdaterChannel beta + - name: yarn set timeout + run: | + yarn config set network-timeout 100000 + - name: yarn install + run: | + yarn install + - name: setCurrentVersion + run: | + yarn setCurrentVersion + - name: printSecrets + run: | + yarn printSecrets + env: + GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + - name: fillPackagedPlugins + run: | + yarn fillPackagedPlugins + - name: Install Snapcraft + if: matrix.os == 'ubuntu-22.04' + uses: samuelmeuli/action-snapcraft@v1 + - name: Publish + run: | + yarn run build:app + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish + + WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} + WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} + # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} + # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} + + CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} + CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} + + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + + SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} + APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} + + # - name: publishSnap + # if: matrix.os == 'ubuntu-22.04' + # run: | + # snapcraft upload --release=beta app/dist/*.snap + # env: + # SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} + + - name: Copy artifacts + run: | + mkdir artifacts + + cp app/dist/*.deb artifacts/dbgate-beta.deb || true + cp app/dist/*x86*.AppImage artifacts/dbgate-beta.AppImage || true + cp app/dist/*arm64*.AppImage artifacts/dbgate-beta-arm64.AppImage || true + cp app/dist/*armv7l*.AppImage artifacts/dbgate-beta-armv7l.AppImage || true + cp app/dist/*win*.exe artifacts/dbgate-beta.exe || true + cp app/dist/*win_x64.zip artifacts/dbgate-windows-beta.zip || true + cp app/dist/*win_arm64.zip artifacts/dbgate-windows-beta-arm64.zip || true + cp app/dist/*-mac_x64.dmg artifacts/dbgate-beta.dmg || true + cp app/dist/*-mac_arm64.dmg artifacts/dbgate-beta-arm64.dmg || true + + mv app/dist/*.exe artifacts/ || true + mv app/dist/*.zip artifacts/ || true + mv app/dist/*.tar.gz artifacts/ || true + mv app/dist/*.AppImage artifacts/ || true + mv app/dist/*.deb artifacts/ || true + mv app/dist/*.snap artifacts/ || true + mv app/dist/*.dmg artifacts/ || true + mv app/dist/*.blockmap artifacts/ || true + + mv app/dist/*.yml artifacts/ || true + rm artifacts/builder-debug.yml + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }} + path: artifacts + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: 'artifacts/**' + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Print content of notarization-error.log + if: failure() && matrix.os == 'macos-14' + run: | + find . -type f -name "notarization-error.log" -exec echo "=== Start of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; diff --git a/workflow-templates/build-app-pro-beta.yaml b/workflow-templates/build-app-pro-beta.yaml new file mode 100644 index 000000000..6c88962e0 --- /dev/null +++ b/workflow-templates/build-app-pro-beta.yaml @@ -0,0 +1,160 @@ +name: Electron app PREMIUM BETA + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + # os: [windows-2022] + # os: [ubuntu-22.04] + # os: [windows-2022, ubuntu-22.04] + os: [macos-14, windows-2022, ubuntu-22.04] + # os: [macOS-10.15] + + steps: + - name: Install python 3.11 (MacOS) + if: matrix.os == 'macos-14' + run: | + brew install python@3.11 + echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV + - name: Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Use Node.js 22.x + uses: actions/setup-node@v1 + with: + node-version: 22.x + + - name: Checkout dbgate/dbgate-pro + uses: actions/checkout@v2 + with: + repository: dbgate/dbgate-pro + token: ${{ secrets.GH_TOKEN }} + path: dbgate-pro + + - name: Merge dbgate/dbgate-pro + run: | + mkdir ../dbgate-pro + mv dbgate-pro/* ../dbgate-pro/ + cd .. + mkdir dbgate-merged + cd dbgate-pro + cd sync + yarn + node sync.js --nowatch + cd .. + + - name: adjustPackageJson + run: | + cd .. + cd dbgate-merged + node adjustPackageJson --premium + - name: setUpdaterChannel premium-beta + run: | + cd .. + cd dbgate-merged + node setUpdaterChannel premium-beta + - name: yarn set timeout + run: | + cd .. + cd dbgate-merged + yarn config set network-timeout 100000 + - name: yarn install + run: | + cd .. + cd dbgate-merged + yarn install + - name: setCurrentVersion + run: | + cd .. + cd dbgate-merged + yarn setCurrentVersion + - name: printSecrets + run: | + cd .. + cd dbgate-merged + yarn printSecrets + env: + GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + - name: fillPackagedPlugins + run: | + cd .. + cd dbgate-merged + yarn fillPackagedPlugins + - name: Publish + run: | + cd .. + cd dbgate-merged + yarn run build:app + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish + + WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} + WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} + # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} + # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} + + CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} + CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} + + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + + APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} + + # DEBUG: electron-builder, electron-notarize, notarytool + + + - name: Copy artifacts + run: | + mkdir artifacts + + cp ../dbgate-merged/app/dist/*x86*.AppImage artifacts/dbgate-premium-beta.AppImage || true + cp ../dbgate-merged/app/dist/*win*.exe artifacts/dbgate-premium-beta.exe || true + cp ../dbgate-merged/app/dist/*-mac_x64.dmg artifacts/dbgate-premium-beta.dmg || true + + mv ../dbgate-merged/app/dist/*.exe artifacts/ || true + mv ../dbgate-merged/app/dist/*.zip artifacts/ || true + mv ../dbgate-merged/app/dist/*.tar.gz artifacts/ || true + mv ../dbgate-merged/app/dist/*.AppImage artifacts/ || true + mv ../dbgate-merged/app/dist/*.deb artifacts/ || true + mv ../dbgate-merged/app/dist/*.snap artifacts/ || true + mv ../dbgate-merged/app/dist/*.dmg artifacts/ || true + mv ../dbgate-merged/app/dist/*.blockmap artifacts/ || true + + mv ../dbgate-merged/app/dist/*.yml artifacts/ || true + rm artifacts/builder-debug.yml + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }} + path: artifacts + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: 'artifacts/**' + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Print content of notarization-error.log + if: failure() && matrix.os == 'macos-14' + run: | + cd .. + cd dbgate-merged + find . -type f -name "notarization-error.log" -exec echo "=== Start of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; diff --git a/workflow-templates/build-app-pro.yaml b/workflow-templates/build-app-pro.yaml new file mode 100644 index 000000000..50f1f0feb --- /dev/null +++ b/workflow-templates/build-app-pro.yaml @@ -0,0 +1,153 @@ +name: Electron app PREMIUM + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + + # branches: + # - production + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + # os: [ubuntu-22.04, windows-2016] + os: [macos-14, windows-2022, ubuntu-22.04] + + steps: + - name: Install python 3.11 (MacOS) + if: matrix.os == 'macos-14' + run: | + brew install python@3.11 + echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV + - name: Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Use Node.js 22.x + uses: actions/setup-node@v1 + with: + node-version: 22.x + + - name: Checkout dbgate/dbgate-pro + uses: actions/checkout@v2 + with: + repository: dbgate/dbgate-pro + token: ${{ secrets.GH_TOKEN }} + path: dbgate-pro + + - name: Merge dbgate/dbgate-pro + run: | + mkdir ../dbgate-pro + mv dbgate-pro/* ../dbgate-pro/ + cd .. + mkdir dbgate-merged + cd dbgate-pro + cd sync + yarn + node sync.js --nowatch + cd .. + + - name: adjustPackageJson + run: | + cd .. + cd dbgate-merged + node adjustPackageJson --premium + - name: setUpdaterChannel premium + run: | + cd .. + cd dbgate-merged + node setUpdaterChannel premium + - name: yarn set timeout + run: | + cd .. + cd dbgate-merged + yarn config set network-timeout 100000 + - name: yarn install + run: | + cd .. + cd dbgate-merged + yarn install + - name: setCurrentVersion + run: | + cd .. + cd dbgate-merged + yarn setCurrentVersion + - name: printSecrets + run: | + cd .. + cd dbgate-merged + yarn printSecrets + env: + GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + - name: fillPackagedPlugins + run: | + cd .. + cd dbgate-merged + yarn fillPackagedPlugins + - name: Publish + run: | + cd .. + cd dbgate-merged + yarn run build:app + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish + + WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} + WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} + # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} + # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} + + CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} + CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} + + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + + APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} + + - name: Copy artifacts + run: | + mkdir artifacts + + cp ../dbgate-merged/app/dist/*x86*.AppImage artifacts/dbgate-premium-latest.AppImage || true + cp ../dbgate-merged/app/dist/*.exe artifacts/dbgate-premium-latest.exe || true + cp ../dbgate-merged/app/dist/*win_x64.zip artifacts/dbgate-premium-windows-latest.zip || true + cp ../dbgate-merged/app/dist/*win_arm64.zip artifacts/dbgate-premium-windows-latest-arm64.zip || true + cp ../dbgate-merged/app/dist/*-mac_universal.dmg artifacts/dbgate-premium-latest.dmg || true + cp ../dbgate-merged/app/dist/*-mac_x64.dmg artifacts/dbgate-premium-latest-x64.dmg || true + cp ../dbgate-merged/app/dist/*-mac_arm64.dmg artifacts/dbgate-premium-latest-arm64.dmg || true + + mv ../dbgate-merged/app/dist/*.exe artifacts/ || true + mv ../dbgate-merged/app/dist/*.zip artifacts/ || true + mv ../dbgate-merged/app/dist/*.tar.gz artifacts/ || true + mv ../dbgate-merged/app/dist/*.AppImage artifacts/ || true + mv ../dbgate-merged/app/dist/*.deb artifacts/ || true + mv ../dbgate-merged/app/dist/*.dmg artifacts/ || true + mv ../dbgate-merged/app/dist/*.blockmap artifacts/ || true + + mv ../dbgate-merged/app/dist/*.yml artifacts/ || true + rm artifacts/builder-debug.yml + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }} + path: artifacts + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: 'artifacts/**' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/workflow-templates/build-app.yaml b/workflow-templates/build-app.yaml new file mode 100644 index 000000000..208911397 --- /dev/null +++ b/workflow-templates/build-app.yaml @@ -0,0 +1,175 @@ +name: Electron app + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + + # branches: + # - production + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + # os: [ubuntu-22.04, windows-2016] + os: [macos-14, windows-2022, ubuntu-22.04] + + steps: + - name: Install python 3.11 (MacOS) + if: matrix.os == 'macos-14' + run: | + brew install python@3.11 + echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV + - name: Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Use Node.js 22.x + uses: actions/setup-node@v1 + with: + node-version: 22.x + - name: adjustPackageJson + run: | + node adjustPackageJson --community + - name: yarn set timeout + run: | + yarn config set network-timeout 100000 + - name: yarn install + run: | + # yarn --version + # yarn config set network-timeout 300000 + yarn install + - name: setCurrentVersion + run: | + yarn setCurrentVersion + - name: printSecrets + run: | + yarn printSecrets + env: + GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + - name: fillPackagedPlugins + run: | + yarn fillPackagedPlugins + - name: Install Snapcraft + if: matrix.os == 'ubuntu-22.04' + uses: samuelmeuli/action-snapcraft@v1 + - name: Publish + run: | + yarn run build:app + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish + + WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} + WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} + # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} + # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} + + CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} + CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} + + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + + SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} + APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} + + - name: generatePadFile + run: | + yarn generatePadFile + + # - name: publishSnap + # if: matrix.os == 'ubuntu-22.04' + # run: | + # snapcraft upload --release=stable app/dist/*.snap + # env: + # SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} + + - name: Copy artifacts + run: | + mkdir artifacts + + cp app/dist/*.deb artifacts/dbgate-latest.deb || true + cp app/dist/*x86*.AppImage artifacts/dbgate-latest.AppImage || true + cp app/dist/*arm64*.AppImage artifacts/dbgate-latest-arm64.AppImage || true + cp app/dist/*armv7l*.AppImage artifacts/dbgate-latest-armv7l.AppImage || true + cp app/dist/*.exe artifacts/dbgate-latest.exe || true + cp app/dist/*win_x64.zip artifacts/dbgate-windows-latest.zip || true + cp app/dist/*win_arm64.zip artifacts/dbgate-windows-latest-arm64.zip || true + cp app/dist/*-mac_universal.dmg artifacts/dbgate-latest.dmg || true + cp app/dist/*-mac_x64.dmg artifacts/dbgate-latest-x64.dmg || true + cp app/dist/*-mac_arm64.dmg artifacts/dbgate-latest-arm64.dmg || true + + mv app/dist/*.exe artifacts/ || true + mv app/dist/*.zip artifacts/ || true + mv app/dist/*.tar.gz artifacts/ || true + mv app/dist/*.AppImage artifacts/ || true + mv app/dist/*.deb artifacts/ || true + mv app/dist/*.dmg artifacts/ || true + mv app/dist/*.snap artifacts/dbgate-latest.snap || true + mv app/dist/*.blockmap artifacts/ || true + + mv app/dist/*.yml artifacts/ || true + rm artifacts/builder-debug.yml + + # - name: Copy artifacts Linux, MacOs + # if: matrix.os != 'windows-2016' + # run: | + # mkdir artifacts + + # cp app/dist/*.AppImage artifacts/ || true + # cp app/dist/*.dmg artifacts/ || true + # cp app/dist/*.deb artifacts/ || true + + # mv app/dist/*.deb artifacts/dbgate-linux.deb || true + # mv app/dist/*.AppImage artifacts/dbgate-linux.AppImage || true + # mv app/dist/*.dmg artifacts/dbgate-mac.dmg || true + + # - name: Copy artifacts Win + # if: matrix.os == 'windows-2016' + # run: | + # mkdir artifacts + + # cp app/dist/*.exe artifacts/ || true + + # mv app/dist/*.exe artifacts/dbgate-windows.exe + + # mv app/dist/latest.yml artifacts/latest.yml || true + + - name: Copy PAD file + if: matrix.os == 'windows-2022' + run: | + mv app/dist/dbgate-pad.xml artifacts/ || true + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }} + path: artifacts + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: 'artifacts/**' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: Create Release + # id: create_release + # uses: actions/create-release@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: ${{ github.ref }} + # release_name: Release ${{ github.ref }} + # draft: false + # prerelease: false diff --git a/workflow-templates/build-aws-pro-beta.yaml b/workflow-templates/build-aws-pro-beta.yaml new file mode 100644 index 000000000..1f68c1b3c --- /dev/null +++ b/workflow-templates/build-aws-pro-beta.yaml @@ -0,0 +1,148 @@ +name: AWS image PREMIUM + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + # - 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-packer-beta.[0-9]+' + +jobs: + build: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - name: Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Use Node.js 18.x + uses: actions/setup-node@v1 + with: + node-version: 18.x + + - name: Setup `packer` + uses: hashicorp/setup-packer@main + with: + version: latest + + - name: Checkout dbgate/dbgate-pro + uses: actions/checkout@v2 + with: + repository: dbgate/dbgate-pro + token: ${{ secrets.GH_TOKEN }} + path: dbgate-pro + + - name: Merge dbgate/dbgate-pro + run: | + mkdir ../dbgate-pro + mv dbgate-pro/* ../dbgate-pro/ + cd .. + mkdir dbgate-merged + cd dbgate-pro + cd sync + yarn + node sync.js --nowatch + cd .. + + - name: adjustPackageJson + run: | + cd .. + cd dbgate-merged + node adjustPackageJson --premium + + - name: yarn install + run: | + cd .. + cd dbgate-merged + yarn install + + - name: setCurrentVersion + run: | + cd .. + cd dbgate-merged + yarn setCurrentVersion + + - name: printSecrets + run: | + cd .. + cd dbgate-merged + yarn printSecrets + env: + GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + + - name: Prepare packer build + run: | + cd .. + cd dbgate-merged + yarn run prepare:packer + cd packer + zip -r cloud-build.zip build + + - name: Copy artifacts + run: | + mkdir artifacts + cp ../dbgate-merged/packer/cloud-build.zip artifacts/cloud-build.zip || true + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }} + path: artifacts + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: 'artifacts/**' + prerelease: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Run `packer init` + run: | + cd ../dbgate-merged/packer + packer init ./aws-ubuntu.pkr.hcl + env: + AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}} + AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}} + AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}} + + - name: Run `packer build` + run: | + cd ../dbgate-merged/packer + packer build ./aws-ubuntu.pkr.hcl + env: + AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}} + AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}} + AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}} + + # - name: Install AWS CLI + # run: | + # curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" + # unzip awscliv2.zip + # sudo ./aws/install + # sudo apt-get install jq -y + + - name: Install jq + run: | + sudo apt-get install jq -y + + - name: Delete old AMIs + run: | + cd ../dbgate-merged/packer + chmod +x delete-old-amis.sh + ./delete-old-amis.sh + env: + AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}} + AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}} + AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}} diff --git a/workflow-templates/build-docker-pro.yaml b/workflow-templates/build-docker-pro.yaml new file mode 100644 index 000000000..146b20246 --- /dev/null +++ b/workflow-templates/build-docker-pro.yaml @@ -0,0 +1,110 @@ +name: Docker image PREMIUM + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' + +jobs: + build: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - name: Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + dbgate/dbgate-premium + flavor: | + latest=false + tags: | + type=raw,value=beta,enable=${{ contains(github.ref_name, '-docker.') || contains(github.ref_name, '-beta.') }} + + type=match,pattern=\d+.\d+.\d+,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} + type=raw,value=latest,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} + + - name: Use Node.js 18.x + uses: actions/setup-node@v1 + with: + node-version: 18.x + + - name: Checkout dbgate/dbgate-pro + uses: actions/checkout@v2 + with: + repository: dbgate/dbgate-pro + token: ${{ secrets.GH_TOKEN }} + path: dbgate-pro + + - name: Merge dbgate/dbgate-pro + run: | + mkdir ../dbgate-pro + mv dbgate-pro/* ../dbgate-pro/ + cd .. + mkdir dbgate-merged + cd dbgate-pro + cd sync + yarn + node sync.js --nowatch + cd .. + + - name: adjustPackageJson + run: | + cd .. + cd dbgate-merged + node adjustPackageJson --premium + + - name: yarn install + run: | + cd .. + cd dbgate-merged + yarn install + + - name: setCurrentVersion + run: | + cd .. + cd dbgate-merged + yarn setCurrentVersion + + - name: printSecrets + run: | + cd .. + cd dbgate-merged + yarn printSecrets + env: + GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + - name: Prepare docker image + run: | + cd .. + cd dbgate-merged + yarn run prepare:docker + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + context: ../dbgate-merged/docker + tags: ${{ steps.meta.outputs.tags }} + platforms: linux/amd64,linux/arm64 diff --git a/workflow-templates/build-docker.tpl.yaml b/workflow-templates/build-docker.tpl.yaml new file mode 100644 index 000000000..030b8c10e --- /dev/null +++ b/workflow-templates/build-docker.tpl.yaml @@ -0,0 +1,132 @@ +_templates: + _community: + file: build-docker.yaml + run: + - from: _cd_merged + to: [] + _premium: + file: build-docker-pro.yaml + run: + - from: _cd_merged + to: + - cd .. + - cd dbgate-merged + +name: + _community: Docker image Community + _premium: Docker image Premium + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + - _community: 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + _premium: - 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - name: Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + _community: dbgate/dbgate + _premium: dbgate/dbgate-premium + flavor: | + latest=false + tags: | + type=raw,value=beta,enable=${{ contains(github.ref_name, '-docker.') || contains(github.ref_name, '-beta.') }} + + type=match,pattern=\d+.\d+.\d+,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} + type=raw,value=latest,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} + + - name: Docker alpine meta + _if: _community + id: alpmeta + uses: docker/metadata-action@v4 + with: + images: | + dbgate/dbgate + flavor: | + latest=false + tags: | + type=raw,value=beta-alpine,enable=${{ contains(github.ref_name, '-docker.') || contains(github.ref_name, '-beta.') }} + + type=match,pattern=\d+.\d+.\d+,suffix=-alpine,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} + type=raw,value=alpine,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} + + - name: Use Node.js 18.x + uses: actions/setup-node@v1 + with: + node-version: 18.x + + - _include: + _name: checkout-dbgate-pro + _if: _premium + + - _include: + _name: merge-dbgate-pro + _if: _premium + + - name: adjustPackageJson + run: | + node adjustPackageJson --community + + - name: yarn install + run: | + # yarn --version + # yarn config set network-timeout 300000 + yarn install + + - name: setCurrentVersion + run: | + yarn setCurrentVersion + + - name: printSecrets + run: | + yarn printSecrets + env: + GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + - name: Prepare docker image + run: | + yarn run prepare:docker + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + context: ./docker + tags: ${{ steps.meta.outputs.tags }} + platforms: linux/amd64,linux/arm64,linux/arm/v7 + + - name: Build and push alpine + uses: docker/build-push-action@v3 + with: + push: true + context: ./docker + file: ./docker/Dockerfile-alpine + tags: ${{ steps.alpmeta.outputs.tags }} + platforms: linux/amd64,linux/arm64,linux/arm/v7 diff --git a/workflow-templates/build-docker.yaml b/workflow-templates/build-docker.yaml new file mode 100644 index 000000000..85737fdd6 --- /dev/null +++ b/workflow-templates/build-docker.yaml @@ -0,0 +1,106 @@ +name: Docker image + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + +jobs: + build: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - name: Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Docker meta + id: meta + uses: docker/metadata-action@v4 + with: + images: | + dbgate/dbgate + flavor: | + latest=false + tags: | + type=raw,value=beta,enable=${{ contains(github.ref_name, '-docker.') || contains(github.ref_name, '-beta.') }} + + type=match,pattern=\d+.\d+.\d+,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} + type=raw,value=latest,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} + + - name: Docker alpine meta + id: alpmeta + uses: docker/metadata-action@v4 + with: + images: | + dbgate/dbgate + flavor: | + latest=false + tags: | + type=raw,value=beta-alpine,enable=${{ contains(github.ref_name, '-docker.') || contains(github.ref_name, '-beta.') }} + + type=match,pattern=\d+.\d+.\d+,suffix=-alpine,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} + type=raw,value=alpine,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} + + - name: Use Node.js 18.x + uses: actions/setup-node@v1 + with: + node-version: 18.x + + - name: adjustPackageJson + run: | + node adjustPackageJson --community + + - name: yarn install + run: | + # yarn --version + # yarn config set network-timeout 300000 + yarn install + + - name: setCurrentVersion + run: | + yarn setCurrentVersion + + - name: printSecrets + run: | + yarn printSecrets + env: + GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + - name: Prepare docker image + run: | + yarn run prepare:docker + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + - name: Login to DockerHub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v3 + with: + push: true + context: ./docker + tags: ${{ steps.meta.outputs.tags }} + platforms: linux/amd64,linux/arm64,linux/arm/v7 + + - name: Build and push alpine + uses: docker/build-push-action@v3 + with: + push: true + context: ./docker + file: ./docker/Dockerfile-alpine + tags: ${{ steps.alpmeta.outputs.tags }} + platforms: linux/amd64,linux/arm64,linux/arm/v7 diff --git a/workflow-templates/build-npm-pro.yaml b/workflow-templates/build-npm-pro.yaml new file mode 100644 index 000000000..154d661c2 --- /dev/null +++ b/workflow-templates/build-npm-pro.yaml @@ -0,0 +1,119 @@ +name: NPM packages PREMIUM + +# on: [push] + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' + +# on: +# push: +# branches: +# - production + +jobs: + build: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - name: Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Use Node.js 18.x + uses: actions/setup-node@v1 + with: + node-version: 18.x + + - name: Checkout dbgate/dbgate-pro + uses: actions/checkout@v2 + with: + repository: dbgate/dbgate-pro + token: ${{ secrets.GH_TOKEN }} + path: dbgate-pro + + - name: Merge dbgate/dbgate-pro + run: | + mkdir ../dbgate-pro + mv dbgate-pro/* ../dbgate-pro/ + cd .. + mkdir dbgate-merged + cd dbgate-pro + cd sync + yarn + node sync.js --nowatch + cd .. + + - name: adjustNpmPackageJsonPremium + run: | + cd .. + cd dbgate-merged + node adjustNpmPackageJsonPremium + + - name: Configure NPM token + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + cd .. + cd dbgate-merged + npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" + + - name: Remove dbmodel - should be not published + run: | + cd .. + cd dbgate-merged + rm -rf packages/dbmodel + + - name: yarn install + run: | + cd .. + cd dbgate-merged + yarn install + + - name: setCurrentVersion + run: | + cd .. + cd dbgate-merged + yarn setCurrentVersion + + - name: printSecrets + run: | + cd .. + cd dbgate-merged + yarn printSecrets + env: + GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + + - name: Publish dbgate-api-premium + run: | + cd .. + cd dbgate-merged/packages/api + npm publish + + - name: Publish dbgate-web-premium + run: | + cd .. + cd dbgate-merged/packages/web + npm publish + + - name: Publish dbgate-serve-premium + run: | + cd .. + cd dbgate-merged/packages/serve + npm publish + + - name: Publish dbgate-plugin-cosmosdb + run: | + cd .. + cd dbgate-merged/plugins/dbgate-plugin-cosmosdb + npm publish diff --git a/workflow-templates/build-npm.yaml b/workflow-templates/build-npm.yaml new file mode 100644 index 000000000..44e5e1d6e --- /dev/null +++ b/workflow-templates/build-npm.yaml @@ -0,0 +1,156 @@ +name: NPM packages + +# on: [push] + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' + +# on: +# push: +# branches: +# - production + +jobs: + build: + + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-22.04] + + steps: + - name: Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Use Node.js 18.x + uses: actions/setup-node@v1 + with: + node-version: 18.x + + - name: Configure NPM token + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" + + - name: yarn install + run: | + yarn install + + - name: setCurrentVersion + run: | + yarn setCurrentVersion + + - name: printSecrets + run: | + yarn printSecrets + env: + GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + + - name: Publish types + working-directory: packages/types + run: | + npm publish + + - name: Publish tools + working-directory: packages/tools + run: | + npm publish + + - name: Publish sqltree + working-directory: packages/sqltree + run: | + npm publish + + - name: Publish api + working-directory: packages/api + run: | + npm publish + + - name: Publish datalib + working-directory: packages/datalib + run: | + npm publish + + - name: Publish filterparser + working-directory: packages/filterparser + run: | + npm publish + + - name: Publish web + working-directory: packages/web + run: | + npm publish + + - name: Publish dbgate-serve + working-directory: packages/serve + run: | + npm publish + + - name: Publish dbmodel + working-directory: packages/dbmodel + run: | + npm publish + + - name: Publish dbgate-plugin-csv + working-directory: plugins/dbgate-plugin-csv + run: | + npm publish + + - name: Publish dbgate-plugin-xml + working-directory: plugins/dbgate-plugin-xml + run: | + npm publish + + - name: Publish dbgate-plugin-excel + working-directory: plugins/dbgate-plugin-excel + run: | + npm publish + + - name: Publish dbgate-plugin-mssql + working-directory: plugins/dbgate-plugin-mssql + run: | + npm publish + + - name: Publish dbgate-plugin-mysql + working-directory: plugins/dbgate-plugin-mysql + run: | + npm publish + + - name: Publish dbgate-plugin-mongo + working-directory: plugins/dbgate-plugin-mongo + run: | + npm publish + + - name: Publish dbgate-plugin-postgres + working-directory: plugins/dbgate-plugin-postgres + run: | + npm publish + + - name: Publish dbgate-plugin-sqlite + working-directory: plugins/dbgate-plugin-sqlite + run: | + npm publish + + - name: Publish dbgate-plugin-redis + working-directory: plugins/dbgate-plugin-redis + run: | + npm publish + + - name: Publish dbgate-plugin-oracle + working-directory: plugins/dbgate-plugin-oracle + run: | + npm publish + + - name: Publish dbgate-plugin-clickhouse + working-directory: plugins/dbgate-plugin-clickhouse + run: | + npm publish diff --git a/workflow-templates/includes.tpl.yaml b/workflow-templates/includes.tpl.yaml new file mode 100644 index 000000000..8261f2dab --- /dev/null +++ b/workflow-templates/includes.tpl.yaml @@ -0,0 +1,22 @@ +_module: true + +checkout-dbgate-pro: + - name: Checkout dbgate/dbgate-pro + uses: actions/checkout@v2 + with: + repository: dbgate/dbgate-pro + token: ${{ secrets.GH_TOKEN }} + path: dbgate-pro + +merge-dbgate-pro: + - name: Merge dbgate/dbgate-pro + run: | + mkdir ../dbgate-pro + mv dbgate-pro/* ../dbgate-pro/ + cd .. + mkdir dbgate-merged + cd dbgate-pro + cd sync + yarn + node sync.js --nowatch + cd .. diff --git a/workflow-templates/run-tests.yaml b/workflow-templates/run-tests.yaml new file mode 100644 index 000000000..c813d251e --- /dev/null +++ b/workflow-templates/run-tests.yaml @@ -0,0 +1,104 @@ +name: Run tests +on: + push: + branches: + - master + - develop + - 'feature/**' + +jobs: + test-runner: + runs-on: ubuntu-latest + container: node:18 + + steps: + - name: Install dependencies for cypress + run: | + apt-get update + apt-get install -y xvfb libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libnss3 libxss1 libasound2 libxtst6 + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: yarn install + run: | + yarn install + - name: Build packer dist for cypress + run: | + yarn prepare:packer + - name: yarn install cypress + run: | + cd e2e-tests + yarn install + - name: Run Cypress tests + run: | + cd e2e-tests + yarn test:ci + - name: Integration tests + run: | + cd integration-tests + yarn test:ci +# yarn wait:ci + - name: Filter parser tests + if: always() + run: | + cd packages/filterparser + yarn test:ci + - name: Datalib (perspective) tests + if: always() + run: | + cd packages/datalib + yarn test:ci + - uses: tanmen/jest-reporter@v1 + if: always() + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-file: integration-tests/result.json + action-name: Integration tests + - uses: tanmen/jest-reporter@v1 + if: always() + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-file: packages/filterparser/result.json + action-name: Filter parser test results + - uses: tanmen/jest-reporter@v1 + if: always() + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + result-file: packages/datalib/result.json + action-name: Datalib (perspectives) test results + + services: + postgres: + image: postgres + env: + POSTGRES_PASSWORD: Pwd2020Db + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + mysql: + image: mysql:8.0.18 + env: + MYSQL_ROOT_PASSWORD: Pwd2020Db + + mssql: + image: mcr.microsoft.com/mssql/server + env: + ACCEPT_EULA: Y + SA_PASSWORD: Pwd2020Db + MSSQL_PID: Express + + clickhouse: + image: bitnami/clickhouse:24.8.4 + env: + CLICKHOUSE_ADMIN_PASSWORD: Pwd2020Db + + oracle: + image: gvenzl/oracle-xe:21-slim + env: + ORACLE_PASSWORD: Pwd2020Db + + # cockroachdb: + # image: cockroachdb/cockroach From e1eea4adf3f8e1f8b7b132c8d42a8ba53fb556a5 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sat, 28 Dec 2024 11:30:18 +0100 Subject: [PATCH 02/15] fixed links to dbgate.org --- README.md | 4 ++-- packages/serve/README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9f64cbf1c..d98a134f6 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ DbGate is licensed under GPL-3.0 license and is free to use for any purpose. * Try it online - [demo.dbgate.org](https://demo.dbgate.org) - online demo application * **Download** application for Windows, Linux or Mac from [dbgate.org](https://dbgate.org/download/) * Run web version as [NPM package](https://www.npmjs.com/package/dbgate-serve) or as [docker image](https://hub.docker.com/r/dbgate/dbgate) -* Use nodeJs [scripting interface](https://dbgate.org/docs/scripting.html) ([API documentation](https://dbgate.org/docs/apidoc.html)) +* Use nodeJs [scripting interface](https://dbgate.org/docs/scripting) ([API documentation](https://dbgate.org/docs/apidoc)) * [Recommend DbGate](https://testimonial.to/dbgate) | [Rate on G2](https://www.g2.com/products/dbgate/reviews) ## Supported databases @@ -87,7 +87,7 @@ Any contributions are welcome. If you want to contribute without coding, conside * Create issue, if you find problem in app, or you have idea to new feature. If issue already exists, you could leave comment on it, to prioritise most wanted issues * Create some tutorial video on [youtube](https://www.youtube.com/playlist?list=PLCo7KjCVXhr0RfUSjM9wJMsp_ShL1q61A) * Become a backer on [GitHub sponsors](https://github.com/sponsors/dbgate) or [Open collective](https://opencollective.com/dbgate) -* Where a small coding is acceptable for you, you could [create plugin](https://dbgate.org/docs/plugin-development.html). Plugins for new themes can be created actually without JS coding +* Where a small coding is acceptable for you, you could [create plugin](https://dbgate.org/docs/plugin-development). Plugins for new themes can be created actually without JS coding Thank you! diff --git a/packages/serve/README.md b/packages/serve/README.md index b6f1a65ca..ad74c9a26 100644 --- a/packages/serve/README.md +++ b/packages/serve/README.md @@ -41,7 +41,7 @@ STORAGE_DATABASE=dbname STORAGE_ENGINE=mysql@dbgate-plugin-mysql ``` -You could find more about environment variable configuration on [DbGate docs](https://dbgate.org/docs/env-variables.html) page. +You could find more about environment variable configuration on [DbGate docs](https://dbgate.org/docs/env-variables/) page. After installing, you can run dbgate with command: ```sh From d3b417679e4fd47175ec153b55eac70fe5cadda4 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sat, 28 Dec 2024 15:00:59 +0100 Subject: [PATCH 03/15] workflow processor --- common/processWorkflows.js | 125 +++++++++++++++++++---- workflow-templates/build-docker.tpl.yaml | 10 +- 2 files changed, 110 insertions(+), 25 deletions(-) diff --git a/common/processWorkflows.js b/common/processWorkflows.js index 8fc2c7350..41ed6d4d3 100644 --- a/common/processWorkflows.js +++ b/common/processWorkflows.js @@ -1,42 +1,127 @@ const fs = require('fs'); const path = require('path'); const yaml = require('js-yaml'); +const rimraf = require('rimraf'); +const _ = require('lodash'); const indir = path.resolve(path.join(__dirname, '..', 'workflow-templates')); const outdir = path.resolve(path.join(__dirname, '..', 'workflow-templates')); const includes = {}; -for (const file of fs.readdirSync(indir)) { - const text = fs.readFileSync(path.join(indir, file), { encoding: 'utf-8' }); - const json = yaml.load(text); - if (json._module) { - for (const key in json) { - if (key === '_module') { - continue; +function readIncludes() { + for (const file of fs.readdirSync(indir)) { + const text = fs.readFileSync(path.join(indir, file), { encoding: 'utf-8' }); + const json = yaml.load(text); + if (json._module) { + for (const key in json) { + if (key === '_module') { + continue; + } + includes[key] = json[key]; } - includes[key] = json[key]; } } } -for (const file of fs.readdirSync(indir)) { - const text = fs.readFileSync(path.join(indir, file), { encoding: 'utf-8' }); - const json = yaml.load(text); +let modified = false; - if (json._module) { - continue; +function conditionMatch(condition, args) { + if (_.isString(condition)) { + return args.name == condition; } + return false; +} - if (json._templates) { - for (const template of json._templates) { - const outfile = template.file; - const text = template.text; - const json = template.json; - const out = path.join(outdir, name); - fs.writeFileSync(out, text); +function processJsonStep(json, args) { + return _.cloneDeepWith(value, x => { + if (_.isArray(value)) { + const res = []; + for (const item of value) { + if (item._if) { + modified = true; + if (conditionMatch(item._if, args)) { + res.push(_.omit(item, ['_if'])); + } + } + } + return res; } + if (value?.run && _.isArray(value.run)) { + const newrun = []; + for (const item of value.run) { + let replaced = false; + for (const repl of args.run) { + if (item == repl.from) { + replaced = true; + modified = true; + newrun.push(...repl.to); + break; + } + } + if (!replaced) { + newrun.push(item); + } + } + return { + ...value, + run: newrun, + }; + } + if (_.isPlainObject(value)) { + if (_.intersection(args.allNames ?? [], Object.keys(values))?.length > 0) { + modified = true; + return value[args.name]; + } + } + }); +} + +function processJson(json, args = {}) { + const MAX_STEPS = 64; + for (let i = 0; i < MAX_STEPS; i++) { + modified = false; + json = processJsonStep(json, args); + if (!modified) { + break; + } + } + return json; +} + +function processFiles() { + for (const file of fs.readdirSync(indir)) { + const text = fs.readFileSync(path.join(indir, file), { encoding: 'utf-8' }); + const json = yaml.load(text); + + if (json._module) { + continue; + } + + if (json._templates) { + for (const key in json._templates) { + const allNames = Object.keys(json._templates); + const args = { + key, + run: json._templates[key], + allNames, + }; + const converted = processJson(_.omit(json, ['_templates']), args); + const out = path.join(outdir, json._templates[key].file); + fs.writeFileSync(out, yaml.dump(converted)); + } + } else { + fs.writeFileSync(path.join(outdir, file), yaml.dump(processJson(json))); + } } } + +async function run() { + await new Promise(resolve => rimraf(outdir, resolve)); + readIncludes(); + processFiles(); +} + +run(); diff --git a/workflow-templates/build-docker.tpl.yaml b/workflow-templates/build-docker.tpl.yaml index 030b8c10e..e5b8f935a 100644 --- a/workflow-templates/build-docker.tpl.yaml +++ b/workflow-templates/build-docker.tpl.yaml @@ -44,7 +44,7 @@ jobs: id: meta uses: docker/metadata-action@v4 with: - images: | + images: _community: dbgate/dbgate _premium: dbgate/dbgate-premium flavor: | @@ -76,12 +76,12 @@ jobs: node-version: 18.x - _include: - _name: checkout-dbgate-pro - _if: _premium + _name: checkout-dbgate-pro + _if: _premium - _include: - _name: merge-dbgate-pro - _if: _premium + _name: merge-dbgate-pro + _if: _premium - name: adjustPackageJson run: | From 2f8c584af5f83c5973e76fcd046a25d3a6404db3 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sat, 28 Dec 2024 15:03:38 +0100 Subject: [PATCH 04/15] workflows --- common/processWorkflows.js | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/common/processWorkflows.js b/common/processWorkflows.js index 41ed6d4d3..1d28168e1 100644 --- a/common/processWorkflows.js +++ b/common/processWorkflows.js @@ -5,7 +5,7 @@ const rimraf = require('rimraf'); const _ = require('lodash'); const indir = path.resolve(path.join(__dirname, '..', 'workflow-templates')); -const outdir = path.resolve(path.join(__dirname, '..', 'workflow-templates')); +const outdir = path.resolve(path.join(__dirname, '..', '.github', 'workflows')); const includes = {}; diff --git a/package.json b/package.json index 0a32e0d61..ae7daa17e 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,8 @@ "ts:web": "yarn workspace dbgate-web ts", "ts": "yarn ts:api && yarn ts:web", "postinstall": "yarn resetPackagedPlugins && yarn build:lib && patch-package && yarn build:plugins:frontend", - "dbgate-serve": "node packages/dbgate/bin/dbgate-serve.js" + "dbgate-serve": "node packages/dbgate/bin/dbgate-serve.js", + "workflows": "node common/processWorkflows.js" }, "dependencies": { "concurrently": "^5.1.0", From 6c9b738717a3ca77d5ab091dd1fa7484fb2fed09 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sat, 28 Dec 2024 15:10:45 +0100 Subject: [PATCH 05/15] fix --- common/processWorkflows.js | 16 +++++++++++----- workflow-templates/build-docker.tpl.yaml | 2 +- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/common/processWorkflows.js b/common/processWorkflows.js index 1d28168e1..f0c1aacfb 100644 --- a/common/processWorkflows.js +++ b/common/processWorkflows.js @@ -1,7 +1,6 @@ const fs = require('fs'); const path = require('path'); const yaml = require('js-yaml'); -const rimraf = require('rimraf'); const _ = require('lodash'); const indir = path.resolve(path.join(__dirname, '..', 'workflow-templates')); @@ -34,7 +33,7 @@ function conditionMatch(condition, args) { } function processJsonStep(json, args) { - return _.cloneDeepWith(value, x => { + return _.cloneDeepWith(json, value => { if (_.isArray(value)) { const res = []; for (const item of value) { @@ -71,7 +70,7 @@ function processJsonStep(json, args) { } if (_.isPlainObject(value)) { - if (_.intersection(args.allNames ?? [], Object.keys(values))?.length > 0) { + if (_.intersection(args.allNames ?? [], Object.keys(value))?.length > 0) { modified = true; return value[args.name]; } @@ -118,8 +117,15 @@ function processFiles() { } } -async function run() { - await new Promise(resolve => rimraf(outdir, resolve)); +function deleteOldFiles() { + const files = fs.readdirSync(outdir); + for (const file of files) { + fs.unlink(path.join(outdir, file)); + } +} + +function run() { + deleteOldFiles(); readIncludes(); processFiles(); } diff --git a/workflow-templates/build-docker.tpl.yaml b/workflow-templates/build-docker.tpl.yaml index e5b8f935a..eecc944f9 100644 --- a/workflow-templates/build-docker.tpl.yaml +++ b/workflow-templates/build-docker.tpl.yaml @@ -21,7 +21,7 @@ on: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - _community: 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' - _premium: - 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' + _premium: 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' jobs: build: From 317f6256f61490cd2717ec85cb0718dec2924048 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sat, 28 Dec 2024 15:28:34 +0100 Subject: [PATCH 06/15] fix --- common/processWorkflows.js | 4 +- workflow-templates/build-docker-pro.yaml | 110 ----------------------- workflow-templates/build-docker.tpl.yaml | 4 +- workflow-templates/build-docker.yaml | 106 ---------------------- 4 files changed, 5 insertions(+), 219 deletions(-) delete mode 100644 workflow-templates/build-docker-pro.yaml delete mode 100644 workflow-templates/build-docker.yaml diff --git a/common/processWorkflows.js b/common/processWorkflows.js index f0c1aacfb..c076b4c05 100644 --- a/common/processWorkflows.js +++ b/common/processWorkflows.js @@ -42,6 +42,8 @@ function processJsonStep(json, args) { if (conditionMatch(item._if, args)) { res.push(_.omit(item, ['_if'])); } + } else { + res.push(item); } } return res; @@ -120,7 +122,7 @@ function processFiles() { function deleteOldFiles() { const files = fs.readdirSync(outdir); for (const file of files) { - fs.unlink(path.join(outdir, file)); + fs.unlinkSync(path.join(outdir, file)); } } diff --git a/workflow-templates/build-docker-pro.yaml b/workflow-templates/build-docker-pro.yaml deleted file mode 100644 index 146b20246..000000000 --- a/workflow-templates/build-docker-pro.yaml +++ /dev/null @@ -1,110 +0,0 @@ -name: Docker image PREMIUM - -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - - 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' - -jobs: - build: - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-22.04] - - steps: - - name: Context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - dbgate/dbgate-premium - flavor: | - latest=false - tags: | - type=raw,value=beta,enable=${{ contains(github.ref_name, '-docker.') || contains(github.ref_name, '-beta.') }} - - type=match,pattern=\d+.\d+.\d+,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} - type=raw,value=latest,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} - - - name: Use Node.js 18.x - uses: actions/setup-node@v1 - with: - node-version: 18.x - - - name: Checkout dbgate/dbgate-pro - uses: actions/checkout@v2 - with: - repository: dbgate/dbgate-pro - token: ${{ secrets.GH_TOKEN }} - path: dbgate-pro - - - name: Merge dbgate/dbgate-pro - run: | - mkdir ../dbgate-pro - mv dbgate-pro/* ../dbgate-pro/ - cd .. - mkdir dbgate-merged - cd dbgate-pro - cd sync - yarn - node sync.js --nowatch - cd .. - - - name: adjustPackageJson - run: | - cd .. - cd dbgate-merged - node adjustPackageJson --premium - - - name: yarn install - run: | - cd .. - cd dbgate-merged - yarn install - - - name: setCurrentVersion - run: | - cd .. - cd dbgate-merged - yarn setCurrentVersion - - - name: printSecrets - run: | - cd .. - cd dbgate-merged - yarn printSecrets - env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - - name: Prepare docker image - run: | - cd .. - cd dbgate-merged - yarn run prepare:docker - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - push: true - context: ../dbgate-merged/docker - tags: ${{ steps.meta.outputs.tags }} - platforms: linux/amd64,linux/arm64 diff --git a/workflow-templates/build-docker.tpl.yaml b/workflow-templates/build-docker.tpl.yaml index eecc944f9..54fd3fea2 100644 --- a/workflow-templates/build-docker.tpl.yaml +++ b/workflow-templates/build-docker.tpl.yaml @@ -77,11 +77,11 @@ jobs: - _include: _name: checkout-dbgate-pro - _if: _premium + _if: _premium - _include: _name: merge-dbgate-pro - _if: _premium + _if: _premium - name: adjustPackageJson run: | diff --git a/workflow-templates/build-docker.yaml b/workflow-templates/build-docker.yaml deleted file mode 100644 index 85737fdd6..000000000 --- a/workflow-templates/build-docker.yaml +++ /dev/null @@ -1,106 +0,0 @@ -name: Docker image - -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' - -jobs: - build: - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: [ubuntu-22.04] - - steps: - - name: Context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v4 - with: - images: | - dbgate/dbgate - flavor: | - latest=false - tags: | - type=raw,value=beta,enable=${{ contains(github.ref_name, '-docker.') || contains(github.ref_name, '-beta.') }} - - type=match,pattern=\d+.\d+.\d+,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} - type=raw,value=latest,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} - - - name: Docker alpine meta - id: alpmeta - uses: docker/metadata-action@v4 - with: - images: | - dbgate/dbgate - flavor: | - latest=false - tags: | - type=raw,value=beta-alpine,enable=${{ contains(github.ref_name, '-docker.') || contains(github.ref_name, '-beta.') }} - - type=match,pattern=\d+.\d+.\d+,suffix=-alpine,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} - type=raw,value=alpine,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} - - - name: Use Node.js 18.x - uses: actions/setup-node@v1 - with: - node-version: 18.x - - - name: adjustPackageJson - run: | - node adjustPackageJson --community - - - name: yarn install - run: | - # yarn --version - # yarn config set network-timeout 300000 - yarn install - - - name: setCurrentVersion - run: | - yarn setCurrentVersion - - - name: printSecrets - run: | - yarn printSecrets - env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - - name: Prepare docker image - run: | - yarn run prepare:docker - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - name: Login to DockerHub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Build and push - uses: docker/build-push-action@v3 - with: - push: true - context: ./docker - tags: ${{ steps.meta.outputs.tags }} - platforms: linux/amd64,linux/arm64,linux/arm/v7 - - - name: Build and push alpine - uses: docker/build-push-action@v3 - with: - push: true - context: ./docker - file: ./docker/Dockerfile-alpine - tags: ${{ steps.alpmeta.outputs.tags }} - platforms: linux/amd64,linux/arm64,linux/arm/v7 From bd0404fbaf62d473f237525eeaf9e1941e549e1b Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sat, 28 Dec 2024 15:36:05 +0100 Subject: [PATCH 07/15] fixes --- common/processWorkflows.js | 8 ++++++-- workflow-templates/build-docker.tpl.yaml | 6 ++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/common/processWorkflows.js b/common/processWorkflows.js index c076b4c05..407b7bae5 100644 --- a/common/processWorkflows.js +++ b/common/processWorkflows.js @@ -27,7 +27,7 @@ let modified = false; function conditionMatch(condition, args) { if (_.isString(condition)) { - return args.name == condition; + return args.key == condition; } return false; } @@ -74,9 +74,13 @@ function processJsonStep(json, args) { if (_.isPlainObject(value)) { if (_.intersection(args.allNames ?? [], Object.keys(value))?.length > 0) { modified = true; - return value[args.name]; + return value[args.key]; } } + + if (value?._include) { + return includes[value?._include]; + } }); } diff --git a/workflow-templates/build-docker.tpl.yaml b/workflow-templates/build-docker.tpl.yaml index 54fd3fea2..be5080d10 100644 --- a/workflow-templates/build-docker.tpl.yaml +++ b/workflow-templates/build-docker.tpl.yaml @@ -75,12 +75,10 @@ jobs: with: node-version: 18.x - - _include: - _name: checkout-dbgate-pro + - _include: checkout-dbgate-pro _if: _premium - - _include: - _name: merge-dbgate-pro + - _include: merge-dbgate-pro _if: _premium - name: adjustPackageJson From 2858bba8b2f9af1e5f5a76c4deec660f0c58623e Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sat, 28 Dec 2024 21:16:52 +0100 Subject: [PATCH 08/15] yaml replace changed --- common/processWorkflows.js | 58 +++++++++++++++--------- workflow-templates/build-docker.tpl.yaml | 16 +++---- 2 files changed, 45 insertions(+), 29 deletions(-) diff --git a/common/processWorkflows.js b/common/processWorkflows.js index 407b7bae5..e5c501245 100644 --- a/common/processWorkflows.js +++ b/common/processWorkflows.js @@ -42,6 +42,18 @@ function processJsonStep(json, args) { if (conditionMatch(item._if, args)) { res.push(_.omit(item, ['_if'])); } + } else if (item._replace || item._include) { + const replaceWith = item._replace ? args.replace?.[item._replace] : includes[item._include]; + if (replaceWith) { + modified = true; + if (_.isArray(replaceWith)) { + res.push(...replaceWith); + } else { + res.push(replaceWith); + } + } else { + res.push(item); + } } else { res.push(item); } @@ -49,27 +61,27 @@ function processJsonStep(json, args) { return res; } - if (value?.run && _.isArray(value.run)) { - const newrun = []; - for (const item of value.run) { - let replaced = false; - for (const repl of args.run) { - if (item == repl.from) { - replaced = true; - modified = true; - newrun.push(...repl.to); - break; - } - } - if (!replaced) { - newrun.push(item); - } - } - return { - ...value, - run: newrun, - }; - } + // if (value?.run && _.isArray(value.run)) { + // const newrun = []; + // for (const item of value.run) { + // let replaced = false; + // for (const repl of args.run) { + // if (item == repl.from) { + // replaced = true; + // modified = true; + // newrun.push(...repl.to); + // break; + // } + // } + // if (!replaced) { + // newrun.push(item); + // } + // } + // return { + // ...value, + // run: newrun, + // }; + // } if (_.isPlainObject(value)) { if (_.intersection(args.allNames ?? [], Object.keys(value))?.length > 0) { @@ -81,6 +93,10 @@ function processJsonStep(json, args) { if (value?._include) { return includes[value?._include]; } + + if (value?._replace) { + return args?.replace[value?._replace]; + } }); } diff --git a/workflow-templates/build-docker.tpl.yaml b/workflow-templates/build-docker.tpl.yaml index be5080d10..5c3169818 100644 --- a/workflow-templates/build-docker.tpl.yaml +++ b/workflow-templates/build-docker.tpl.yaml @@ -1,16 +1,16 @@ _templates: _community: file: build-docker.yaml - run: - - from: _cd_merged - to: [] + replace: + _cd_merged: + - cd .. + - cd dbgate-merged _premium: file: build-docker-pro.yaml - run: - - from: _cd_merged - to: - - cd .. - - cd dbgate-merged + replace: + _cd_merged: + - cd .. + - cd dbgate-merged name: _community: Docker image Community From 70873e83bd412d87ec37822ace4f109a6ab0c549 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sun, 29 Dec 2024 09:57:18 +0100 Subject: [PATCH 09/15] docker pipeline refactor --- common/processWorkflows.js | 35 +++++++++++++++++--- workflow-templates/build-docker.tpl.yaml | 41 ++++++++++++++---------- workflow-templates/includes.tpl.yaml | 4 +-- 3 files changed, 56 insertions(+), 24 deletions(-) diff --git a/common/processWorkflows.js b/common/processWorkflows.js index e5c501245..9bd21831e 100644 --- a/common/processWorkflows.js +++ b/common/processWorkflows.js @@ -36,9 +36,11 @@ function processJsonStep(json, args) { return _.cloneDeepWith(json, value => { if (_.isArray(value)) { const res = []; + let arrayModified = false; for (const item of value) { if (item._if) { modified = true; + arrayModified = true; if (conditionMatch(item._if, args)) { res.push(_.omit(item, ['_if'])); } @@ -46,6 +48,7 @@ function processJsonStep(json, args) { const replaceWith = item._replace ? args.replace?.[item._replace] : includes[item._include]; if (replaceWith) { modified = true; + arrayModified = true; if (_.isArray(replaceWith)) { res.push(...replaceWith); } else { @@ -58,7 +61,10 @@ function processJsonStep(json, args) { res.push(item); } } - return res; + if (arrayModified) { + return res; + } + return undefined; } // if (value?.run && _.isArray(value.run)) { @@ -90,11 +96,28 @@ function processJsonStep(json, args) { } } + if (_.isString(value)) { + let stringModified = false; + for (const key of Object.keys(args.stringReplace ?? {})) { + if (value.includes(key)) { + modified = true; + stringModified = true; + value = value.replaceAll(key, args.stringReplace[key]); + } + } + if (stringModified) { + return value; + } + return undefined; + } + if (value?._include) { + modified = true; return includes[value?._include]; } if (value?._replace) { + modified = true; return args?.replace[value?._replace]; } }); @@ -113,6 +136,9 @@ function processJson(json, args = {}) { } function processFiles() { + const dumpOptions = { + lineWidth: -1, + }; for (const file of fs.readdirSync(indir)) { const text = fs.readFileSync(path.join(indir, file), { encoding: 'utf-8' }); const json = yaml.load(text); @@ -126,15 +152,16 @@ function processFiles() { const allNames = Object.keys(json._templates); const args = { key, - run: json._templates[key], + replace: json._templates[key]?.replace, + stringReplace: json._templates[key]?.['string-replace'], allNames, }; const converted = processJson(_.omit(json, ['_templates']), args); const out = path.join(outdir, json._templates[key].file); - fs.writeFileSync(out, yaml.dump(converted)); + fs.writeFileSync(out, yaml.dump(converted, dumpOptions)); } } else { - fs.writeFileSync(path.join(outdir, file), yaml.dump(processJson(json))); + fs.writeFileSync(path.join(outdir, file), yaml.dump(processJson(json), dumpOptions)); } } } diff --git a/workflow-templates/build-docker.tpl.yaml b/workflow-templates/build-docker.tpl.yaml index 5c3169818..aaedb6a1a 100644 --- a/workflow-templates/build-docker.tpl.yaml +++ b/workflow-templates/build-docker.tpl.yaml @@ -1,20 +1,20 @@ _templates: _community: file: build-docker.yaml - replace: - _cd_merged: - - cd .. - - cd dbgate-merged + string-replace: + "<>": '' + "<>": community _premium: file: build-docker-pro.yaml - replace: - _cd_merged: - - cd .. - - cd dbgate-merged + string-replace: + "<>": | + cd .. + cd dbgate-merged + "<>": premium name: _community: Docker image Community - _premium: Docker image Premium + _premium: Docker image PREMIUM on: push: @@ -75,33 +75,35 @@ jobs: with: node-version: 18.x - - _include: checkout-dbgate-pro - _if: _premium - - - _include: merge-dbgate-pro + - _include: checkout-and-merge-pro _if: _premium - name: adjustPackageJson run: | - node adjustPackageJson --community + <> + node adjustPackageJson --<> - name: yarn install run: | + <> # yarn --version # yarn config set network-timeout 300000 yarn install - name: setCurrentVersion run: | + <> yarn setCurrentVersion - name: printSecrets run: | - yarn printSecrets + <> + yarn printSecrets env: GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - name: Prepare docker image run: | + <> yarn run prepare:docker - name: Set up Docker Buildx @@ -116,12 +118,17 @@ jobs: uses: docker/build-push-action@v3 with: push: true - context: ./docker + context: + _community: ./docker + _premium: ../dbgate-merged/docker tags: ${{ steps.meta.outputs.tags }} - platforms: linux/amd64,linux/arm64,linux/arm/v7 + platforms: + _community: linux/amd64,linux/arm64,linux/arm/v7 + _premium: linux/amd64,linux/arm64 - name: Build and push alpine uses: docker/build-push-action@v3 + _if: _community with: push: true context: ./docker diff --git a/workflow-templates/includes.tpl.yaml b/workflow-templates/includes.tpl.yaml index 8261f2dab..82be38b1f 100644 --- a/workflow-templates/includes.tpl.yaml +++ b/workflow-templates/includes.tpl.yaml @@ -1,14 +1,12 @@ _module: true -checkout-dbgate-pro: +checkout-and-merge-pro: - name: Checkout dbgate/dbgate-pro uses: actions/checkout@v2 with: repository: dbgate/dbgate-pro token: ${{ secrets.GH_TOKEN }} path: dbgate-pro - -merge-dbgate-pro: - name: Merge dbgate/dbgate-pro run: | mkdir ../dbgate-pro From f7b39fca26cc0b84bd808202e9d54aa875f8eedf Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sun, 29 Dec 2024 09:57:33 +0100 Subject: [PATCH 10/15] code cleanup --- common/processWorkflows.js | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/common/processWorkflows.js b/common/processWorkflows.js index 9bd21831e..8760d4508 100644 --- a/common/processWorkflows.js +++ b/common/processWorkflows.js @@ -67,28 +67,6 @@ function processJsonStep(json, args) { return undefined; } - // if (value?.run && _.isArray(value.run)) { - // const newrun = []; - // for (const item of value.run) { - // let replaced = false; - // for (const repl of args.run) { - // if (item == repl.from) { - // replaced = true; - // modified = true; - // newrun.push(...repl.to); - // break; - // } - // } - // if (!replaced) { - // newrun.push(item); - // } - // } - // return { - // ...value, - // run: newrun, - // }; - // } - if (_.isPlainObject(value)) { if (_.intersection(args.allNames ?? [], Object.keys(value))?.length > 0) { modified = true; From 70083bd8702da6bfe6eaeca91e44dd1cb6efd19e Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Mon, 30 Dec 2024 07:05:25 +0100 Subject: [PATCH 11/15] workflows - defs support --- common/processWorkflows.js | 21 ++- workflow-templates/build-app.tpl.yaml | 198 +++++++++++++++++++++++ workflow-templates/build-docker.tpl.yaml | 6 +- 3 files changed, 216 insertions(+), 9 deletions(-) create mode 100644 workflow-templates/build-app.tpl.yaml diff --git a/common/processWorkflows.js b/common/processWorkflows.js index 8760d4508..c40066b8c 100644 --- a/common/processWorkflows.js +++ b/common/processWorkflows.js @@ -27,7 +27,7 @@ let modified = false; function conditionMatch(condition, args) { if (_.isString(condition)) { - return args.key == condition; + return args.defs.includes(condition); } return false; } @@ -68,9 +68,14 @@ function processJsonStep(json, args) { } if (_.isPlainObject(value)) { - if (_.intersection(args.allNames ?? [], Object.keys(value))?.length > 0) { + if (_.intersection(args.allDefs ?? [], Object.keys(value))?.length > 0) { modified = true; - return value[args.key]; + for (const key in value) { + if (args.defs.includes(key)) { + return value[key]; + } + } + return undefined; } } @@ -126,13 +131,17 @@ function processFiles() { } if (json._templates) { + const allDefs = Object.keys(json._templates); + for (const key in json._templates) { + allDefs.push(...(json._templates[key].defs ?? [])); + } + for (const key in json._templates) { - const allNames = Object.keys(json._templates); const args = { - key, + defs: [key, ...(json._templates[key]?.defs ?? [])], replace: json._templates[key]?.replace, stringReplace: json._templates[key]?.['string-replace'], - allNames, + allDefs, }; const converted = processJson(_.omit(json, ['_templates']), args); const out = path.join(outdir, json._templates[key].file); diff --git a/workflow-templates/build-app.tpl.yaml b/workflow-templates/build-app.tpl.yaml new file mode 100644 index 000000000..03a20c898 --- /dev/null +++ b/workflow-templates/build-app.tpl.yaml @@ -0,0 +1,198 @@ +_templates: + _community_beta: + file: build-app-beta.yaml + defs: + - _community + - _beta + string-replace: + "<>": '' + "<>": '--community' + _community_stable: + file: build-app.yaml + defs: + - _community + - _stable + string-replace: + "<>": '' + "<>": '--community' + + _premium_beta: + file: build-app-pro-beta.yaml + defs: + - _premium + - _beta + string-replace: + "<>": | + cd .. + cd dbgate-merged + "<>": '--premium' + _premium_stable: + file: build-app-pro.yaml + defs: + - _premium + - _stable + string-replace: + "<>": | + cd .. + cd dbgate-merged + "<>": '--premium' + +name: + _community_beta: Electron app BETA + _community_stable: Electron app + _premium_beta: Electron app PREMIUM BETA + _premium_stable: Electron app PREMIUM + +on: + push: + tags: + - _community_beta: 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + _premium_beta: 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' + _stable: 'v[0-9]+.[0-9]+.[0-9]+' + # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + + # branches: + # - production + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + # os: [ubuntu-22.04, windows-2016] + os: [macos-14, windows-2022, ubuntu-22.04] + + steps: + - name: Install python 3.11 (MacOS) + if: matrix.os == 'macos-14' + run: | + brew install python@3.11 + echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV + - name: Context + env: + GITHUB_CONTEXT: ${{ toJson(github) }} + run: echo "$GITHUB_CONTEXT" + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - name: Use Node.js 22.x + uses: actions/setup-node@v1 + with: + node-version: 22.x + + - name: Checkout dbgate/dbgate-pro + uses: actions/checkout@v2 + with: + repository: dbgate/dbgate-pro + token: ${{ secrets.GH_TOKEN }} + path: dbgate-pro + + - name: Merge dbgate/dbgate-pro + run: | + mkdir ../dbgate-pro + mv dbgate-pro/* ../dbgate-pro/ + cd .. + mkdir dbgate-merged + cd dbgate-pro + cd sync + yarn + node sync.js --nowatch + cd .. + + - name: adjustPackageJson + run: | + cd .. + cd dbgate-merged + node adjustPackageJson --premium + - name: setUpdaterChannel premium + run: | + cd .. + cd dbgate-merged + node setUpdaterChannel premium + - name: yarn set timeout + run: | + cd .. + cd dbgate-merged + yarn config set network-timeout 100000 + - name: yarn install + run: | + cd .. + cd dbgate-merged + yarn install + - name: setCurrentVersion + run: | + cd .. + cd dbgate-merged + yarn setCurrentVersion + - name: printSecrets + run: | + cd .. + cd dbgate-merged + yarn printSecrets + env: + GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + - name: fillPackagedPlugins + run: | + cd .. + cd dbgate-merged + yarn fillPackagedPlugins + - name: Publish + run: | + cd .. + cd dbgate-merged + yarn run build:app + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish + + WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} + WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} + # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} + # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} + + CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} + CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} + + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + + APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} + + - name: Copy artifacts + run: | + mkdir artifacts + + cp ../dbgate-merged/app/dist/*x86*.AppImage artifacts/dbgate-premium-latest.AppImage || true + cp ../dbgate-merged/app/dist/*.exe artifacts/dbgate-premium-latest.exe || true + cp ../dbgate-merged/app/dist/*win_x64.zip artifacts/dbgate-premium-windows-latest.zip || true + cp ../dbgate-merged/app/dist/*win_arm64.zip artifacts/dbgate-premium-windows-latest-arm64.zip || true + cp ../dbgate-merged/app/dist/*-mac_universal.dmg artifacts/dbgate-premium-latest.dmg || true + cp ../dbgate-merged/app/dist/*-mac_x64.dmg artifacts/dbgate-premium-latest-x64.dmg || true + cp ../dbgate-merged/app/dist/*-mac_arm64.dmg artifacts/dbgate-premium-latest-arm64.dmg || true + + mv ../dbgate-merged/app/dist/*.exe artifacts/ || true + mv ../dbgate-merged/app/dist/*.zip artifacts/ || true + mv ../dbgate-merged/app/dist/*.tar.gz artifacts/ || true + mv ../dbgate-merged/app/dist/*.AppImage artifacts/ || true + mv ../dbgate-merged/app/dist/*.deb artifacts/ || true + mv ../dbgate-merged/app/dist/*.dmg artifacts/ || true + mv ../dbgate-merged/app/dist/*.blockmap artifacts/ || true + + mv ../dbgate-merged/app/dist/*.yml artifacts/ || true + rm artifacts/builder-debug.yml + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }} + path: artifacts + + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: 'artifacts/**' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/workflow-templates/build-docker.tpl.yaml b/workflow-templates/build-docker.tpl.yaml index aaedb6a1a..eabc1cabc 100644 --- a/workflow-templates/build-docker.tpl.yaml +++ b/workflow-templates/build-docker.tpl.yaml @@ -3,14 +3,14 @@ _templates: file: build-docker.yaml string-replace: "<>": '' - "<>": community + "<>": '--community' _premium: file: build-docker-pro.yaml string-replace: "<>": | cd .. cd dbgate-merged - "<>": premium + "<>": '--premium' name: _community: Docker image Community @@ -81,7 +81,7 @@ jobs: - name: adjustPackageJson run: | <> - node adjustPackageJson --<> + node adjustPackageJson <> - name: yarn install run: | From 36e2f1bdee8ddae44b55f90e1286d49f1b0e6c19 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Mon, 30 Dec 2024 08:11:18 +0100 Subject: [PATCH 12/15] workflow templates --- workflow-templates/build-app-beta.yaml | 133 ---------------- workflow-templates/build-app-pro-beta.yaml | 160 ------------------- workflow-templates/build-app-pro.yaml | 153 ------------------ workflow-templates/build-app.tpl.yaml | 126 +++++++++------ workflow-templates/build-app.yaml | 175 --------------------- workflow-templates/build-npm-pro.yaml | 19 +-- 6 files changed, 75 insertions(+), 691 deletions(-) delete mode 100644 workflow-templates/build-app-beta.yaml delete mode 100644 workflow-templates/build-app-pro-beta.yaml delete mode 100644 workflow-templates/build-app-pro.yaml delete mode 100644 workflow-templates/build-app.yaml diff --git a/workflow-templates/build-app-beta.yaml b/workflow-templates/build-app-beta.yaml deleted file mode 100644 index 7b7fd078c..000000000 --- a/workflow-templates/build-app-beta.yaml +++ /dev/null @@ -1,133 +0,0 @@ -name: Electron app BETA - -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' - -jobs: - build: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - os: [macos-14, windows-2022, ubuntu-22.04] - # os: [macOS-10.15] - - steps: - - name: Install python 3.11 (MacOS) - if: matrix.os == 'macos-14' - run: | - brew install python@3.11 - echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV - - name: Context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - name: Use Node.js 22.x - uses: actions/setup-node@v1 - with: - node-version: 22.x - - name: adjustPackageJson - run: | - node adjustPackageJson --community - - name: setUpdaterChannel beta - run: | - node setUpdaterChannel beta - - name: yarn set timeout - run: | - yarn config set network-timeout 100000 - - name: yarn install - run: | - yarn install - - name: setCurrentVersion - run: | - yarn setCurrentVersion - - name: printSecrets - run: | - yarn printSecrets - env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - - name: fillPackagedPlugins - run: | - yarn fillPackagedPlugins - - name: Install Snapcraft - if: matrix.os == 'ubuntu-22.04' - uses: samuelmeuli/action-snapcraft@v1 - - name: Publish - run: | - yarn run build:app - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish - - WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} - WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} - # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} - # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} - - CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} - CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} - - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - - SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} - APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} - - # - name: publishSnap - # if: matrix.os == 'ubuntu-22.04' - # run: | - # snapcraft upload --release=beta app/dist/*.snap - # env: - # SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} - - - name: Copy artifacts - run: | - mkdir artifacts - - cp app/dist/*.deb artifacts/dbgate-beta.deb || true - cp app/dist/*x86*.AppImage artifacts/dbgate-beta.AppImage || true - cp app/dist/*arm64*.AppImage artifacts/dbgate-beta-arm64.AppImage || true - cp app/dist/*armv7l*.AppImage artifacts/dbgate-beta-armv7l.AppImage || true - cp app/dist/*win*.exe artifacts/dbgate-beta.exe || true - cp app/dist/*win_x64.zip artifacts/dbgate-windows-beta.zip || true - cp app/dist/*win_arm64.zip artifacts/dbgate-windows-beta-arm64.zip || true - cp app/dist/*-mac_x64.dmg artifacts/dbgate-beta.dmg || true - cp app/dist/*-mac_arm64.dmg artifacts/dbgate-beta-arm64.dmg || true - - mv app/dist/*.exe artifacts/ || true - mv app/dist/*.zip artifacts/ || true - mv app/dist/*.tar.gz artifacts/ || true - mv app/dist/*.AppImage artifacts/ || true - mv app/dist/*.deb artifacts/ || true - mv app/dist/*.snap artifacts/ || true - mv app/dist/*.dmg artifacts/ || true - mv app/dist/*.blockmap artifacts/ || true - - mv app/dist/*.yml artifacts/ || true - rm artifacts/builder-debug.yml - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.os }} - path: artifacts - - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: 'artifacts/**' - prerelease: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Print content of notarization-error.log - if: failure() && matrix.os == 'macos-14' - run: | - find . -type f -name "notarization-error.log" -exec echo "=== Start of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; diff --git a/workflow-templates/build-app-pro-beta.yaml b/workflow-templates/build-app-pro-beta.yaml deleted file mode 100644 index 6c88962e0..000000000 --- a/workflow-templates/build-app-pro-beta.yaml +++ /dev/null @@ -1,160 +0,0 @@ -name: Electron app PREMIUM BETA - -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' - -jobs: - build: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - # os: [windows-2022] - # os: [ubuntu-22.04] - # os: [windows-2022, ubuntu-22.04] - os: [macos-14, windows-2022, ubuntu-22.04] - # os: [macOS-10.15] - - steps: - - name: Install python 3.11 (MacOS) - if: matrix.os == 'macos-14' - run: | - brew install python@3.11 - echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV - - name: Context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - name: Use Node.js 22.x - uses: actions/setup-node@v1 - with: - node-version: 22.x - - - name: Checkout dbgate/dbgate-pro - uses: actions/checkout@v2 - with: - repository: dbgate/dbgate-pro - token: ${{ secrets.GH_TOKEN }} - path: dbgate-pro - - - name: Merge dbgate/dbgate-pro - run: | - mkdir ../dbgate-pro - mv dbgate-pro/* ../dbgate-pro/ - cd .. - mkdir dbgate-merged - cd dbgate-pro - cd sync - yarn - node sync.js --nowatch - cd .. - - - name: adjustPackageJson - run: | - cd .. - cd dbgate-merged - node adjustPackageJson --premium - - name: setUpdaterChannel premium-beta - run: | - cd .. - cd dbgate-merged - node setUpdaterChannel premium-beta - - name: yarn set timeout - run: | - cd .. - cd dbgate-merged - yarn config set network-timeout 100000 - - name: yarn install - run: | - cd .. - cd dbgate-merged - yarn install - - name: setCurrentVersion - run: | - cd .. - cd dbgate-merged - yarn setCurrentVersion - - name: printSecrets - run: | - cd .. - cd dbgate-merged - yarn printSecrets - env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - - name: fillPackagedPlugins - run: | - cd .. - cd dbgate-merged - yarn fillPackagedPlugins - - name: Publish - run: | - cd .. - cd dbgate-merged - yarn run build:app - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish - - WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} - WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} - # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} - # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} - - CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} - CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} - - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - - APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} - - # DEBUG: electron-builder, electron-notarize, notarytool - - - - name: Copy artifacts - run: | - mkdir artifacts - - cp ../dbgate-merged/app/dist/*x86*.AppImage artifacts/dbgate-premium-beta.AppImage || true - cp ../dbgate-merged/app/dist/*win*.exe artifacts/dbgate-premium-beta.exe || true - cp ../dbgate-merged/app/dist/*-mac_x64.dmg artifacts/dbgate-premium-beta.dmg || true - - mv ../dbgate-merged/app/dist/*.exe artifacts/ || true - mv ../dbgate-merged/app/dist/*.zip artifacts/ || true - mv ../dbgate-merged/app/dist/*.tar.gz artifacts/ || true - mv ../dbgate-merged/app/dist/*.AppImage artifacts/ || true - mv ../dbgate-merged/app/dist/*.deb artifacts/ || true - mv ../dbgate-merged/app/dist/*.snap artifacts/ || true - mv ../dbgate-merged/app/dist/*.dmg artifacts/ || true - mv ../dbgate-merged/app/dist/*.blockmap artifacts/ || true - - mv ../dbgate-merged/app/dist/*.yml artifacts/ || true - rm artifacts/builder-debug.yml - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.os }} - path: artifacts - - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: 'artifacts/**' - prerelease: true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Print content of notarization-error.log - if: failure() && matrix.os == 'macos-14' - run: | - cd .. - cd dbgate-merged - find . -type f -name "notarization-error.log" -exec echo "=== Start of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; diff --git a/workflow-templates/build-app-pro.yaml b/workflow-templates/build-app-pro.yaml deleted file mode 100644 index 50f1f0feb..000000000 --- a/workflow-templates/build-app-pro.yaml +++ /dev/null @@ -1,153 +0,0 @@ -name: Electron app PREMIUM - -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - - # branches: - # - production - -jobs: - build: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - # os: [ubuntu-22.04, windows-2016] - os: [macos-14, windows-2022, ubuntu-22.04] - - steps: - - name: Install python 3.11 (MacOS) - if: matrix.os == 'macos-14' - run: | - brew install python@3.11 - echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV - - name: Context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - name: Use Node.js 22.x - uses: actions/setup-node@v1 - with: - node-version: 22.x - - - name: Checkout dbgate/dbgate-pro - uses: actions/checkout@v2 - with: - repository: dbgate/dbgate-pro - token: ${{ secrets.GH_TOKEN }} - path: dbgate-pro - - - name: Merge dbgate/dbgate-pro - run: | - mkdir ../dbgate-pro - mv dbgate-pro/* ../dbgate-pro/ - cd .. - mkdir dbgate-merged - cd dbgate-pro - cd sync - yarn - node sync.js --nowatch - cd .. - - - name: adjustPackageJson - run: | - cd .. - cd dbgate-merged - node adjustPackageJson --premium - - name: setUpdaterChannel premium - run: | - cd .. - cd dbgate-merged - node setUpdaterChannel premium - - name: yarn set timeout - run: | - cd .. - cd dbgate-merged - yarn config set network-timeout 100000 - - name: yarn install - run: | - cd .. - cd dbgate-merged - yarn install - - name: setCurrentVersion - run: | - cd .. - cd dbgate-merged - yarn setCurrentVersion - - name: printSecrets - run: | - cd .. - cd dbgate-merged - yarn printSecrets - env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - - name: fillPackagedPlugins - run: | - cd .. - cd dbgate-merged - yarn fillPackagedPlugins - - name: Publish - run: | - cd .. - cd dbgate-merged - yarn run build:app - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish - - WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} - WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} - # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} - # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} - - CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} - CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} - - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - - APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} - - - name: Copy artifacts - run: | - mkdir artifacts - - cp ../dbgate-merged/app/dist/*x86*.AppImage artifacts/dbgate-premium-latest.AppImage || true - cp ../dbgate-merged/app/dist/*.exe artifacts/dbgate-premium-latest.exe || true - cp ../dbgate-merged/app/dist/*win_x64.zip artifacts/dbgate-premium-windows-latest.zip || true - cp ../dbgate-merged/app/dist/*win_arm64.zip artifacts/dbgate-premium-windows-latest-arm64.zip || true - cp ../dbgate-merged/app/dist/*-mac_universal.dmg artifacts/dbgate-premium-latest.dmg || true - cp ../dbgate-merged/app/dist/*-mac_x64.dmg artifacts/dbgate-premium-latest-x64.dmg || true - cp ../dbgate-merged/app/dist/*-mac_arm64.dmg artifacts/dbgate-premium-latest-arm64.dmg || true - - mv ../dbgate-merged/app/dist/*.exe artifacts/ || true - mv ../dbgate-merged/app/dist/*.zip artifacts/ || true - mv ../dbgate-merged/app/dist/*.tar.gz artifacts/ || true - mv ../dbgate-merged/app/dist/*.AppImage artifacts/ || true - mv ../dbgate-merged/app/dist/*.deb artifacts/ || true - mv ../dbgate-merged/app/dist/*.dmg artifacts/ || true - mv ../dbgate-merged/app/dist/*.blockmap artifacts/ || true - - mv ../dbgate-merged/app/dist/*.yml artifacts/ || true - rm artifacts/builder-debug.yml - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.os }} - path: artifacts - - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: 'artifacts/**' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/workflow-templates/build-app.tpl.yaml b/workflow-templates/build-app.tpl.yaml index 03a20c898..37598e53a 100644 --- a/workflow-templates/build-app.tpl.yaml +++ b/workflow-templates/build-app.tpl.yaml @@ -4,9 +4,13 @@ _templates: defs: - _community - _beta + - _channel string-replace: "<>": '' "<>": '--community' + "<>": 'app/dist' + "<>": beta + "<>": 'beta' _community_stable: file: build-app.yaml defs: @@ -15,27 +19,38 @@ _templates: string-replace: "<>": '' "<>": '--community' + "<>": 'app/dist' + "<>": 'latest' + _premium_beta: file: build-app-pro-beta.yaml defs: - _premium - _beta + - _channel string-replace: "<>": | cd .. cd dbgate-merged "<>": '--premium' + "<>": '../dbgate-merged/app/dist' + "<>": 'premium-beta' + "<>": 'premium-beta' _premium_stable: file: build-app-pro.yaml defs: - _premium - _stable + - _channel string-replace: "<>": | cd .. cd dbgate-merged "<>": '--premium' + "<>": '../dbgate-merged/app/dist' + "<>": 'premium' + "<>": 'premium-latest' name: _community_beta: Electron app BETA @@ -82,66 +97,47 @@ jobs: with: node-version: 22.x - - name: Checkout dbgate/dbgate-pro - uses: actions/checkout@v2 - with: - repository: dbgate/dbgate-pro - token: ${{ secrets.GH_TOKEN }} - path: dbgate-pro - - - name: Merge dbgate/dbgate-pro - run: | - mkdir ../dbgate-pro - mv dbgate-pro/* ../dbgate-pro/ - cd .. - mkdir dbgate-merged - cd dbgate-pro - cd sync - yarn - node sync.js --nowatch - cd .. + - _include: checkout-and-merge-pro + _if: _premium - name: adjustPackageJson run: | - cd .. - cd dbgate-merged - node adjustPackageJson --premium - - name: setUpdaterChannel premium + <> + node adjustPackageJson <> + - name: setUpdaterChannel <> + _if: _channel run: | - cd .. - cd dbgate-merged - node setUpdaterChannel premium + <> + node setUpdaterChannel <> - name: yarn set timeout run: | - cd .. - cd dbgate-merged + <> yarn config set network-timeout 100000 - name: yarn install run: | - cd .. - cd dbgate-merged + <> yarn install - name: setCurrentVersion run: | - cd .. - cd dbgate-merged + <> yarn setCurrentVersion - name: printSecrets run: | - cd .. - cd dbgate-merged + <> yarn printSecrets env: GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - name: fillPackagedPlugins run: | - cd .. - cd dbgate-merged + <> yarn fillPackagedPlugins + - name: Install Snapcraft + _if: _community + if: matrix.os == 'ubuntu-22.04' + uses: samuelmeuli/action-snapcraft@v1 - name: Publish run: | - cd .. - cd dbgate-merged + <> yarn run build:app env: GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish @@ -158,31 +154,48 @@ jobs: APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} + - name: generatePadFile + _if: _community_stable + run: | + yarn generatePadFile + - name: Copy artifacts run: | mkdir artifacts - cp ../dbgate-merged/app/dist/*x86*.AppImage artifacts/dbgate-premium-latest.AppImage || true - cp ../dbgate-merged/app/dist/*.exe artifacts/dbgate-premium-latest.exe || true - cp ../dbgate-merged/app/dist/*win_x64.zip artifacts/dbgate-premium-windows-latest.zip || true - cp ../dbgate-merged/app/dist/*win_arm64.zip artifacts/dbgate-premium-windows-latest-arm64.zip || true - cp ../dbgate-merged/app/dist/*-mac_universal.dmg artifacts/dbgate-premium-latest.dmg || true - cp ../dbgate-merged/app/dist/*-mac_x64.dmg artifacts/dbgate-premium-latest-x64.dmg || true - cp ../dbgate-merged/app/dist/*-mac_arm64.dmg artifacts/dbgate-premium-latest-arm64.dmg || true + cp <>/*.deb artifacts/dbgate-<>.deb || true + cp <>/*x86*.AppImage artifacts/dbgate-<>.AppImage || true + cp <>/*arm64*.AppImage artifacts/dbgate-<>-arm64.AppImage || true + cp <>/*armv7l*.AppImage artifacts/dbgate-<>-armv7l.AppImage || true + cp <>/*win*.exe artifacts/dbgate-<>.exe || true + cp <>/*win_x64.zip artifacts/dbgate-windows-<>.zip || true + cp <>/*win_arm64.zip artifacts/dbgate-windows-<>-arm64.zip || true + cp <>/*-mac_universal.dmg artifacts/dbgate-<>.dmg || true + cp <>/*-mac_x64.dmg artifacts/dbgate-<>-x64.dmg || true + cp <>/*-mac_arm64.dmg artifacts/dbgate-<>-arm64.dmg || true + mv <>/*.snap artifacts/dbgate-<>.snap || true - mv ../dbgate-merged/app/dist/*.exe artifacts/ || true - mv ../dbgate-merged/app/dist/*.zip artifacts/ || true - mv ../dbgate-merged/app/dist/*.tar.gz artifacts/ || true - mv ../dbgate-merged/app/dist/*.AppImage artifacts/ || true - mv ../dbgate-merged/app/dist/*.deb artifacts/ || true - mv ../dbgate-merged/app/dist/*.dmg artifacts/ || true - mv ../dbgate-merged/app/dist/*.blockmap artifacts/ || true + mv <>/*.exe artifacts/ || true + mv <>/*.zip artifacts/ || true + mv <>/*.tar.gz artifacts/ || true + mv <>/*.AppImage artifacts/ || true + mv <>/*.deb artifacts/ || true + mv <>/*.snap artifacts/ || true + mv <>/*.dmg artifacts/ || true + mv <>/*.blockmap artifacts/ || true - mv ../dbgate-merged/app/dist/*.yml artifacts/ || true + mv <>/*.yml artifacts/ || true rm artifacts/builder-debug.yml + - name: Copy PAD file + _if: _community_stable + if: matrix.os == 'windows-2022' + run: | + mv app/dist/dbgate-pad.xml artifacts/ || true + - name: Upload artifacts uses: actions/upload-artifact@v4 with: @@ -194,5 +207,14 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: files: 'artifacts/**' + prerelease: + _beta: true + _stable: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Print content of notarization-error.log + if: failure() && matrix.os == 'macos-14' + run: | + <> + find . -type f -name "notarization-error.log" -exec echo "=== Start of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; diff --git a/workflow-templates/build-app.yaml b/workflow-templates/build-app.yaml deleted file mode 100644 index 208911397..000000000 --- a/workflow-templates/build-app.yaml +++ /dev/null @@ -1,175 +0,0 @@ -name: Electron app - -on: - push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' - # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - - # branches: - # - production - -jobs: - build: - runs-on: ${{ matrix.os }} - - strategy: - fail-fast: false - matrix: - # os: [ubuntu-22.04, windows-2016] - os: [macos-14, windows-2022, ubuntu-22.04] - - steps: - - name: Install python 3.11 (MacOS) - if: matrix.os == 'macos-14' - run: | - brew install python@3.11 - echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV - - name: Context - env: - GITHUB_CONTEXT: ${{ toJson(github) }} - run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - name: Use Node.js 22.x - uses: actions/setup-node@v1 - with: - node-version: 22.x - - name: adjustPackageJson - run: | - node adjustPackageJson --community - - name: yarn set timeout - run: | - yarn config set network-timeout 100000 - - name: yarn install - run: | - # yarn --version - # yarn config set network-timeout 300000 - yarn install - - name: setCurrentVersion - run: | - yarn setCurrentVersion - - name: printSecrets - run: | - yarn printSecrets - env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - - name: fillPackagedPlugins - run: | - yarn fillPackagedPlugins - - name: Install Snapcraft - if: matrix.os == 'ubuntu-22.04' - uses: samuelmeuli/action-snapcraft@v1 - - name: Publish - run: | - yarn run build:app - env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish - - WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} - WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} - # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} - # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} - - CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} - CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} - - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - - SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} - APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} - - - name: generatePadFile - run: | - yarn generatePadFile - - # - name: publishSnap - # if: matrix.os == 'ubuntu-22.04' - # run: | - # snapcraft upload --release=stable app/dist/*.snap - # env: - # SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} - - - name: Copy artifacts - run: | - mkdir artifacts - - cp app/dist/*.deb artifacts/dbgate-latest.deb || true - cp app/dist/*x86*.AppImage artifacts/dbgate-latest.AppImage || true - cp app/dist/*arm64*.AppImage artifacts/dbgate-latest-arm64.AppImage || true - cp app/dist/*armv7l*.AppImage artifacts/dbgate-latest-armv7l.AppImage || true - cp app/dist/*.exe artifacts/dbgate-latest.exe || true - cp app/dist/*win_x64.zip artifacts/dbgate-windows-latest.zip || true - cp app/dist/*win_arm64.zip artifacts/dbgate-windows-latest-arm64.zip || true - cp app/dist/*-mac_universal.dmg artifacts/dbgate-latest.dmg || true - cp app/dist/*-mac_x64.dmg artifacts/dbgate-latest-x64.dmg || true - cp app/dist/*-mac_arm64.dmg artifacts/dbgate-latest-arm64.dmg || true - - mv app/dist/*.exe artifacts/ || true - mv app/dist/*.zip artifacts/ || true - mv app/dist/*.tar.gz artifacts/ || true - mv app/dist/*.AppImage artifacts/ || true - mv app/dist/*.deb artifacts/ || true - mv app/dist/*.dmg artifacts/ || true - mv app/dist/*.snap artifacts/dbgate-latest.snap || true - mv app/dist/*.blockmap artifacts/ || true - - mv app/dist/*.yml artifacts/ || true - rm artifacts/builder-debug.yml - - # - name: Copy artifacts Linux, MacOs - # if: matrix.os != 'windows-2016' - # run: | - # mkdir artifacts - - # cp app/dist/*.AppImage artifacts/ || true - # cp app/dist/*.dmg artifacts/ || true - # cp app/dist/*.deb artifacts/ || true - - # mv app/dist/*.deb artifacts/dbgate-linux.deb || true - # mv app/dist/*.AppImage artifacts/dbgate-linux.AppImage || true - # mv app/dist/*.dmg artifacts/dbgate-mac.dmg || true - - # - name: Copy artifacts Win - # if: matrix.os == 'windows-2016' - # run: | - # mkdir artifacts - - # cp app/dist/*.exe artifacts/ || true - - # mv app/dist/*.exe artifacts/dbgate-windows.exe - - # mv app/dist/latest.yml artifacts/latest.yml || true - - - name: Copy PAD file - if: matrix.os == 'windows-2022' - run: | - mv app/dist/dbgate-pad.xml artifacts/ || true - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: ${{ matrix.os }} - path: artifacts - - - name: Release - uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') - with: - files: 'artifacts/**' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # - name: Create Release - # id: create_release - # uses: actions/create-release@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # tag_name: ${{ github.ref }} - # release_name: Release ${{ github.ref }} - # draft: false - # prerelease: false diff --git a/workflow-templates/build-npm-pro.yaml b/workflow-templates/build-npm-pro.yaml index 154d661c2..cdf9b6b5c 100644 --- a/workflow-templates/build-npm-pro.yaml +++ b/workflow-templates/build-npm-pro.yaml @@ -35,24 +35,7 @@ jobs: with: node-version: 18.x - - name: Checkout dbgate/dbgate-pro - uses: actions/checkout@v2 - with: - repository: dbgate/dbgate-pro - token: ${{ secrets.GH_TOKEN }} - path: dbgate-pro - - - name: Merge dbgate/dbgate-pro - run: | - mkdir ../dbgate-pro - mv dbgate-pro/* ../dbgate-pro/ - cd .. - mkdir dbgate-merged - cd dbgate-pro - cd sync - yarn - node sync.js --nowatch - cd .. + - _include: checkout-and-merge-pro - name: adjustNpmPackageJsonPremium run: | From ac3bb581069bce15c675ecd150611166d7a0bd98 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Mon, 30 Dec 2024 08:23:18 +0100 Subject: [PATCH 13/15] generated workflows --- .github/workflows/build-app-beta.yaml | 78 ++++++-------- .github/workflows/build-app-pro-beta.yaml | 87 ++++++++------- .github/workflows/build-app-pro.yaml | 90 ++++++++-------- .github/workflows/build-app.yaml | 123 +++++++--------------- .github/workflows/build-aws-pro-beta.yaml | 68 ++++-------- .github/workflows/build-docker-pro.yaml | 48 ++++----- .github/workflows/build-docker.yaml | 50 ++++----- .github/workflows/build-npm-pro.yaml | 39 ++----- .github/workflows/build-npm.yaml | 50 ++------- .github/workflows/run-tests.yaml | 37 ++----- 10 files changed, 249 insertions(+), 421 deletions(-) diff --git a/.github/workflows/build-app-beta.yaml b/.github/workflows/build-app-beta.yaml index 7b7fd078c..6199e55e9 100644 --- a/.github/workflows/build-app-beta.yaml +++ b/.github/workflows/build-app-beta.yaml @@ -1,20 +1,18 @@ name: Electron app BETA - -on: +'on': push: tags: - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' - jobs: build: - runs-on: ${{ matrix.os }} - + runs-on: '${{ matrix.os }}' strategy: fail-fast: false matrix: - os: [macos-14, windows-2022, ubuntu-22.04] - # os: [macOS-10.15] - + os: + - macos-14 + - windows-2022 + - ubuntu-22.04 steps: - name: Install python 3.11 (MacOS) if: matrix.os == 'macos-14' @@ -23,7 +21,7 @@ jobs: echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV - name: Context env: - GITHUB_CONTEXT: ${{ toJson(github) }} + GITHUB_CONTEXT: '${{ toJson(github) }}' run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v2 with: @@ -34,58 +32,52 @@ jobs: node-version: 22.x - name: adjustPackageJson run: | + node adjustPackageJson --community - name: setUpdaterChannel beta run: | + node setUpdaterChannel beta - name: yarn set timeout run: | + yarn config set network-timeout 100000 - name: yarn install run: | + yarn install - name: setCurrentVersion run: | + yarn setCurrentVersion - name: printSecrets run: | - yarn printSecrets + + yarn printSecrets env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + GIST_UPLOAD_SECRET: '${{secrets.GIST_UPLOAD_SECRET}}' - name: fillPackagedPlugins run: | + yarn fillPackagedPlugins - name: Install Snapcraft if: matrix.os == 'ubuntu-22.04' uses: samuelmeuli/action-snapcraft@v1 - name: Publish run: | + yarn run build:app env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish - - WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} - WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} - # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} - # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} - - CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} - CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} - - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - - SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} - APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} - - # - name: publishSnap - # if: matrix.os == 'ubuntu-22.04' - # run: | - # snapcraft upload --release=beta app/dist/*.snap - # env: - # SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} - + GH_TOKEN: '${{ secrets.GH_TOKEN }}' + WIN_CSC_LINK: '${{ secrets.WINCERT_2025 }}' + WIN_CSC_KEY_PASSWORD: '${{ secrets.WINCERT_2025_PASSWORD }}' + CSC_LINK: '${{ secrets.APPLECERT_CERTIFICATE }}' + CSC_KEY_PASSWORD: '${{ secrets.APPLECERT_PASSWORD }}' + APPLE_ID: '${{ secrets.APPLE_ID }}' + APPLE_TEAM_ID: '${{ secrets.APPLE_TEAM_ID }}' + APPLE_ID_PASSWORD: '${{ secrets.APPLE_ID_PASSWORD }}' + SNAPCRAFT_STORE_CREDENTIALS: '${{secrets.SNAPCRAFT_LOGIN}}' + APPLE_APP_SPECIFIC_PASSWORD: '${{secrets.APPLE_APP_SPECIFIC_PASSWORD}}' - name: Copy artifacts run: | mkdir artifacts @@ -97,8 +89,10 @@ jobs: cp app/dist/*win*.exe artifacts/dbgate-beta.exe || true cp app/dist/*win_x64.zip artifacts/dbgate-windows-beta.zip || true cp app/dist/*win_arm64.zip artifacts/dbgate-windows-beta-arm64.zip || true - cp app/dist/*-mac_x64.dmg artifacts/dbgate-beta.dmg || true + cp app/dist/*-mac_universal.dmg artifacts/dbgate-beta.dmg || true + cp app/dist/*-mac_x64.dmg artifacts/dbgate-beta-x64.dmg || true cp app/dist/*-mac_arm64.dmg artifacts/dbgate-beta-arm64.dmg || true + mv app/dist/*.snap artifacts/dbgate-beta.snap || true mv app/dist/*.exe artifacts/ || true mv app/dist/*.zip artifacts/ || true @@ -111,23 +105,21 @@ jobs: mv app/dist/*.yml artifacts/ || true rm artifacts/builder-debug.yml - - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: ${{ matrix.os }} + name: '${{ matrix.os }}' path: artifacts - - name: Release uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') + if: 'startsWith(github.ref, ''refs/tags/'')' with: - files: 'artifacts/**' + files: artifacts/** prerelease: true env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - name: Print content of notarization-error.log if: failure() && matrix.os == 'macos-14' run: | + find . -type f -name "notarization-error.log" -exec echo "=== Start of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; diff --git a/.github/workflows/build-app-pro-beta.yaml b/.github/workflows/build-app-pro-beta.yaml index 6c88962e0..61c55d736 100644 --- a/.github/workflows/build-app-pro-beta.yaml +++ b/.github/workflows/build-app-pro-beta.yaml @@ -1,23 +1,18 @@ name: Electron app PREMIUM BETA - -on: +'on': push: tags: - 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' - jobs: build: - runs-on: ${{ matrix.os }} - + runs-on: '${{ matrix.os }}' strategy: fail-fast: false matrix: - # os: [windows-2022] - # os: [ubuntu-22.04] - # os: [windows-2022, ubuntu-22.04] - os: [macos-14, windows-2022, ubuntu-22.04] - # os: [macOS-10.15] - + os: + - macos-14 + - windows-2022 + - ubuntu-22.04 steps: - name: Install python 3.11 (MacOS) if: matrix.os == 'macos-14' @@ -26,7 +21,7 @@ jobs: echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV - name: Context env: - GITHUB_CONTEXT: ${{ toJson(github) }} + GITHUB_CONTEXT: '${{ toJson(github) }}' run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v2 with: @@ -35,14 +30,12 @@ jobs: uses: actions/setup-node@v1 with: node-version: 22.x - - name: Checkout dbgate/dbgate-pro uses: actions/checkout@v2 with: repository: dbgate/dbgate-pro - token: ${{ secrets.GH_TOKEN }} + token: '${{ secrets.GH_TOKEN }}' path: dbgate-pro - - name: Merge dbgate/dbgate-pro run: | mkdir ../dbgate-pro @@ -54,76 +47,82 @@ jobs: yarn node sync.js --nowatch cd .. - - name: adjustPackageJson run: | cd .. cd dbgate-merged + node adjustPackageJson --premium - name: setUpdaterChannel premium-beta run: | cd .. cd dbgate-merged + node setUpdaterChannel premium-beta - name: yarn set timeout run: | cd .. cd dbgate-merged + yarn config set network-timeout 100000 - name: yarn install run: | cd .. cd dbgate-merged + yarn install - name: setCurrentVersion run: | cd .. cd dbgate-merged + yarn setCurrentVersion - name: printSecrets run: | cd .. cd dbgate-merged - yarn printSecrets + + yarn printSecrets env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + GIST_UPLOAD_SECRET: '${{secrets.GIST_UPLOAD_SECRET}}' - name: fillPackagedPlugins run: | cd .. cd dbgate-merged + yarn fillPackagedPlugins - name: Publish run: | cd .. cd dbgate-merged + yarn run build:app env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish - - WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} - WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} - # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} - # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} - - CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} - CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} - - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - - APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} - - # DEBUG: electron-builder, electron-notarize, notarytool - - + GH_TOKEN: '${{ secrets.GH_TOKEN }}' + WIN_CSC_LINK: '${{ secrets.WINCERT_2025 }}' + WIN_CSC_KEY_PASSWORD: '${{ secrets.WINCERT_2025_PASSWORD }}' + CSC_LINK: '${{ secrets.APPLECERT_CERTIFICATE }}' + CSC_KEY_PASSWORD: '${{ secrets.APPLECERT_PASSWORD }}' + APPLE_ID: '${{ secrets.APPLE_ID }}' + APPLE_TEAM_ID: '${{ secrets.APPLE_TEAM_ID }}' + APPLE_ID_PASSWORD: '${{ secrets.APPLE_ID_PASSWORD }}' + SNAPCRAFT_STORE_CREDENTIALS: '${{secrets.SNAPCRAFT_LOGIN}}' + APPLE_APP_SPECIFIC_PASSWORD: '${{secrets.APPLE_APP_SPECIFIC_PASSWORD}}' - name: Copy artifacts run: | mkdir artifacts + cp ../dbgate-merged/app/dist/*.deb artifacts/dbgate-premium-beta.deb || true cp ../dbgate-merged/app/dist/*x86*.AppImage artifacts/dbgate-premium-beta.AppImage || true + cp ../dbgate-merged/app/dist/*arm64*.AppImage artifacts/dbgate-premium-beta-arm64.AppImage || true + cp ../dbgate-merged/app/dist/*armv7l*.AppImage artifacts/dbgate-premium-beta-armv7l.AppImage || true cp ../dbgate-merged/app/dist/*win*.exe artifacts/dbgate-premium-beta.exe || true - cp ../dbgate-merged/app/dist/*-mac_x64.dmg artifacts/dbgate-premium-beta.dmg || true + cp ../dbgate-merged/app/dist/*win_x64.zip artifacts/dbgate-windows-premium-beta.zip || true + cp ../dbgate-merged/app/dist/*win_arm64.zip artifacts/dbgate-windows-premium-beta-arm64.zip || true + cp ../dbgate-merged/app/dist/*-mac_universal.dmg artifacts/dbgate-premium-beta.dmg || true + cp ../dbgate-merged/app/dist/*-mac_x64.dmg artifacts/dbgate-premium-beta-x64.dmg || true + cp ../dbgate-merged/app/dist/*-mac_arm64.dmg artifacts/dbgate-premium-beta-arm64.dmg || true + mv ../dbgate-merged/app/dist/*.snap artifacts/dbgate-premium-beta.snap || true mv ../dbgate-merged/app/dist/*.exe artifacts/ || true mv ../dbgate-merged/app/dist/*.zip artifacts/ || true @@ -136,25 +135,23 @@ jobs: mv ../dbgate-merged/app/dist/*.yml artifacts/ || true rm artifacts/builder-debug.yml - - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: ${{ matrix.os }} + name: '${{ matrix.os }}' path: artifacts - - name: Release uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') + if: 'startsWith(github.ref, ''refs/tags/'')' with: - files: 'artifacts/**' + files: artifacts/** prerelease: true env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - name: Print content of notarization-error.log if: failure() && matrix.os == 'macos-14' run: | cd .. cd dbgate-merged + find . -type f -name "notarization-error.log" -exec echo "=== Start of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; diff --git a/.github/workflows/build-app-pro.yaml b/.github/workflows/build-app-pro.yaml index 50f1f0feb..73a0c9067 100644 --- a/.github/workflows/build-app-pro.yaml +++ b/.github/workflows/build-app-pro.yaml @@ -1,24 +1,18 @@ name: Electron app PREMIUM - -on: +'on': push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - - # branches: - # - production - jobs: build: - runs-on: ${{ matrix.os }} - + runs-on: '${{ matrix.os }}' strategy: fail-fast: false matrix: - # os: [ubuntu-22.04, windows-2016] - os: [macos-14, windows-2022, ubuntu-22.04] - + os: + - macos-14 + - windows-2022 + - ubuntu-22.04 steps: - name: Install python 3.11 (MacOS) if: matrix.os == 'macos-14' @@ -27,7 +21,7 @@ jobs: echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV - name: Context env: - GITHUB_CONTEXT: ${{ toJson(github) }} + GITHUB_CONTEXT: '${{ toJson(github) }}' run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v2 with: @@ -36,14 +30,12 @@ jobs: uses: actions/setup-node@v1 with: node-version: 22.x - - name: Checkout dbgate/dbgate-pro uses: actions/checkout@v2 with: repository: dbgate/dbgate-pro - token: ${{ secrets.GH_TOKEN }} + token: '${{ secrets.GH_TOKEN }}' path: dbgate-pro - - name: Merge dbgate/dbgate-pro run: | mkdir ../dbgate-pro @@ -55,99 +47,111 @@ jobs: yarn node sync.js --nowatch cd .. - - name: adjustPackageJson run: | cd .. cd dbgate-merged + node adjustPackageJson --premium - name: setUpdaterChannel premium run: | cd .. cd dbgate-merged + node setUpdaterChannel premium - name: yarn set timeout run: | cd .. cd dbgate-merged + yarn config set network-timeout 100000 - name: yarn install run: | cd .. cd dbgate-merged + yarn install - name: setCurrentVersion run: | cd .. cd dbgate-merged + yarn setCurrentVersion - name: printSecrets run: | cd .. cd dbgate-merged + yarn printSecrets env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + GIST_UPLOAD_SECRET: '${{secrets.GIST_UPLOAD_SECRET}}' - name: fillPackagedPlugins run: | cd .. cd dbgate-merged + yarn fillPackagedPlugins - name: Publish run: | cd .. cd dbgate-merged + yarn run build:app env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish - - WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} - WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} - # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} - # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} - - CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} - CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} - - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - - APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} - + GH_TOKEN: '${{ secrets.GH_TOKEN }}' + WIN_CSC_LINK: '${{ secrets.WINCERT_2025 }}' + WIN_CSC_KEY_PASSWORD: '${{ secrets.WINCERT_2025_PASSWORD }}' + CSC_LINK: '${{ secrets.APPLECERT_CERTIFICATE }}' + CSC_KEY_PASSWORD: '${{ secrets.APPLECERT_PASSWORD }}' + APPLE_ID: '${{ secrets.APPLE_ID }}' + APPLE_TEAM_ID: '${{ secrets.APPLE_TEAM_ID }}' + APPLE_ID_PASSWORD: '${{ secrets.APPLE_ID_PASSWORD }}' + SNAPCRAFT_STORE_CREDENTIALS: '${{secrets.SNAPCRAFT_LOGIN}}' + APPLE_APP_SPECIFIC_PASSWORD: '${{secrets.APPLE_APP_SPECIFIC_PASSWORD}}' - name: Copy artifacts run: | mkdir artifacts + cp ../dbgate-merged/app/dist/*.deb artifacts/dbgate-premium-latest.deb || true cp ../dbgate-merged/app/dist/*x86*.AppImage artifacts/dbgate-premium-latest.AppImage || true - cp ../dbgate-merged/app/dist/*.exe artifacts/dbgate-premium-latest.exe || true - cp ../dbgate-merged/app/dist/*win_x64.zip artifacts/dbgate-premium-windows-latest.zip || true - cp ../dbgate-merged/app/dist/*win_arm64.zip artifacts/dbgate-premium-windows-latest-arm64.zip || true + cp ../dbgate-merged/app/dist/*arm64*.AppImage artifacts/dbgate-premium-latest-arm64.AppImage || true + cp ../dbgate-merged/app/dist/*armv7l*.AppImage artifacts/dbgate-premium-latest-armv7l.AppImage || true + cp ../dbgate-merged/app/dist/*win*.exe artifacts/dbgate-premium-latest.exe || true + cp ../dbgate-merged/app/dist/*win_x64.zip artifacts/dbgate-windows-premium-latest.zip || true + cp ../dbgate-merged/app/dist/*win_arm64.zip artifacts/dbgate-windows-premium-latest-arm64.zip || true cp ../dbgate-merged/app/dist/*-mac_universal.dmg artifacts/dbgate-premium-latest.dmg || true cp ../dbgate-merged/app/dist/*-mac_x64.dmg artifacts/dbgate-premium-latest-x64.dmg || true cp ../dbgate-merged/app/dist/*-mac_arm64.dmg artifacts/dbgate-premium-latest-arm64.dmg || true + mv ../dbgate-merged/app/dist/*.snap artifacts/dbgate-premium-latest.snap || true mv ../dbgate-merged/app/dist/*.exe artifacts/ || true mv ../dbgate-merged/app/dist/*.zip artifacts/ || true mv ../dbgate-merged/app/dist/*.tar.gz artifacts/ || true mv ../dbgate-merged/app/dist/*.AppImage artifacts/ || true mv ../dbgate-merged/app/dist/*.deb artifacts/ || true + mv ../dbgate-merged/app/dist/*.snap artifacts/ || true mv ../dbgate-merged/app/dist/*.dmg artifacts/ || true mv ../dbgate-merged/app/dist/*.blockmap artifacts/ || true mv ../dbgate-merged/app/dist/*.yml artifacts/ || true rm artifacts/builder-debug.yml - - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: ${{ matrix.os }} + name: '${{ matrix.os }}' path: artifacts - - name: Release uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') + if: 'startsWith(github.ref, ''refs/tags/'')' with: - files: 'artifacts/**' + files: artifacts/** + prerelease: false env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + - name: Print content of notarization-error.log + if: failure() && matrix.os == 'macos-14' + run: | + cd .. + cd dbgate-merged + + find . -type f -name "notarization-error.log" -exec echo "=== Start of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; diff --git a/.github/workflows/build-app.yaml b/.github/workflows/build-app.yaml index 208911397..231488914 100644 --- a/.github/workflows/build-app.yaml +++ b/.github/workflows/build-app.yaml @@ -1,24 +1,18 @@ name: Electron app - -on: +'on': push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - - # branches: - # - production - jobs: build: - runs-on: ${{ matrix.os }} - + runs-on: '${{ matrix.os }}' strategy: fail-fast: false matrix: - # os: [ubuntu-22.04, windows-2016] - os: [macos-14, windows-2022, ubuntu-22.04] - + os: + - macos-14 + - windows-2022 + - ubuntu-22.04 steps: - name: Install python 3.11 (MacOS) if: matrix.os == 'macos-14' @@ -27,7 +21,7 @@ jobs: echo "PYTHON=/opt/homebrew/bin/python3.11" >> $GITHUB_ENV - name: Context env: - GITHUB_CONTEXT: ${{ toJson(github) }} + GITHUB_CONTEXT: '${{ toJson(github) }}' run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v2 with: @@ -38,61 +32,51 @@ jobs: node-version: 22.x - name: adjustPackageJson run: | + node adjustPackageJson --community - name: yarn set timeout run: | + yarn config set network-timeout 100000 - name: yarn install run: | - # yarn --version - # yarn config set network-timeout 300000 + yarn install - name: setCurrentVersion run: | + yarn setCurrentVersion - name: printSecrets run: | - yarn printSecrets + + yarn printSecrets env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + GIST_UPLOAD_SECRET: '${{secrets.GIST_UPLOAD_SECRET}}' - name: fillPackagedPlugins run: | + yarn fillPackagedPlugins - name: Install Snapcraft if: matrix.os == 'ubuntu-22.04' uses: samuelmeuli/action-snapcraft@v1 - name: Publish run: | + yarn run build:app env: - GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish - - WIN_CSC_LINK: ${{ secrets.WINCERT_2025 }} - WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_2025_PASSWORD }} - # WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} - # WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} - - CSC_LINK: ${{ secrets.APPLECERT_CERTIFICATE }} - CSC_KEY_PASSWORD: ${{ secrets.APPLECERT_PASSWORD }} - - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - - SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} - APPLE_APP_SPECIFIC_PASSWORD: ${{secrets.APPLE_APP_SPECIFIC_PASSWORD}} - + GH_TOKEN: '${{ secrets.GH_TOKEN }}' + WIN_CSC_LINK: '${{ secrets.WINCERT_2025 }}' + WIN_CSC_KEY_PASSWORD: '${{ secrets.WINCERT_2025_PASSWORD }}' + CSC_LINK: '${{ secrets.APPLECERT_CERTIFICATE }}' + CSC_KEY_PASSWORD: '${{ secrets.APPLECERT_PASSWORD }}' + APPLE_ID: '${{ secrets.APPLE_ID }}' + APPLE_TEAM_ID: '${{ secrets.APPLE_TEAM_ID }}' + APPLE_ID_PASSWORD: '${{ secrets.APPLE_ID_PASSWORD }}' + SNAPCRAFT_STORE_CREDENTIALS: '${{secrets.SNAPCRAFT_LOGIN}}' + APPLE_APP_SPECIFIC_PASSWORD: '${{secrets.APPLE_APP_SPECIFIC_PASSWORD}}' - name: generatePadFile run: | yarn generatePadFile - - # - name: publishSnap - # if: matrix.os == 'ubuntu-22.04' - # run: | - # snapcraft upload --release=stable app/dist/*.snap - # env: - # SNAPCRAFT_STORE_CREDENTIALS: ${{secrets.SNAPCRAFT_LOGIN}} - - name: Copy artifacts run: | mkdir artifacts @@ -101,75 +85,44 @@ jobs: cp app/dist/*x86*.AppImage artifacts/dbgate-latest.AppImage || true cp app/dist/*arm64*.AppImage artifacts/dbgate-latest-arm64.AppImage || true cp app/dist/*armv7l*.AppImage artifacts/dbgate-latest-armv7l.AppImage || true - cp app/dist/*.exe artifacts/dbgate-latest.exe || true + cp app/dist/*win*.exe artifacts/dbgate-latest.exe || true cp app/dist/*win_x64.zip artifacts/dbgate-windows-latest.zip || true cp app/dist/*win_arm64.zip artifacts/dbgate-windows-latest-arm64.zip || true cp app/dist/*-mac_universal.dmg artifacts/dbgate-latest.dmg || true cp app/dist/*-mac_x64.dmg artifacts/dbgate-latest-x64.dmg || true cp app/dist/*-mac_arm64.dmg artifacts/dbgate-latest-arm64.dmg || true + mv app/dist/*.snap artifacts/dbgate-latest.snap || true mv app/dist/*.exe artifacts/ || true mv app/dist/*.zip artifacts/ || true mv app/dist/*.tar.gz artifacts/ || true mv app/dist/*.AppImage artifacts/ || true mv app/dist/*.deb artifacts/ || true + mv app/dist/*.snap artifacts/ || true mv app/dist/*.dmg artifacts/ || true - mv app/dist/*.snap artifacts/dbgate-latest.snap || true mv app/dist/*.blockmap artifacts/ || true mv app/dist/*.yml artifacts/ || true rm artifacts/builder-debug.yml - - # - name: Copy artifacts Linux, MacOs - # if: matrix.os != 'windows-2016' - # run: | - # mkdir artifacts - - # cp app/dist/*.AppImage artifacts/ || true - # cp app/dist/*.dmg artifacts/ || true - # cp app/dist/*.deb artifacts/ || true - - # mv app/dist/*.deb artifacts/dbgate-linux.deb || true - # mv app/dist/*.AppImage artifacts/dbgate-linux.AppImage || true - # mv app/dist/*.dmg artifacts/dbgate-mac.dmg || true - - # - name: Copy artifacts Win - # if: matrix.os == 'windows-2016' - # run: | - # mkdir artifacts - - # cp app/dist/*.exe artifacts/ || true - - # mv app/dist/*.exe artifacts/dbgate-windows.exe - - # mv app/dist/latest.yml artifacts/latest.yml || true - - name: Copy PAD file if: matrix.os == 'windows-2022' run: | mv app/dist/dbgate-pad.xml artifacts/ || true - - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: ${{ matrix.os }} + name: '${{ matrix.os }}' path: artifacts - - name: Release uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') + if: 'startsWith(github.ref, ''refs/tags/'')' with: - files: 'artifacts/**' + files: artifacts/** + prerelease: false env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' + - name: Print content of notarization-error.log + if: failure() && matrix.os == 'macos-14' + run: | - # - name: Create Release - # id: create_release - # uses: actions/create-release@v1 - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # tag_name: ${{ github.ref }} - # release_name: Release ${{ github.ref }} - # draft: false - # prerelease: false + find . -type f -name "notarization-error.log" -exec echo "=== Start of {} ===" \; -exec cat {} \; -exec echo "=== End of {} ===" \; diff --git a/.github/workflows/build-aws-pro-beta.yaml b/.github/workflows/build-aws-pro-beta.yaml index 1f68c1b3c..60250cfb9 100644 --- a/.github/workflows/build-aws-pro-beta.yaml +++ b/.github/workflows/build-aws-pro-beta.yaml @@ -1,47 +1,38 @@ name: AWS image PREMIUM - -on: +'on': push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - # - 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-packer-beta.[0-9]+' - jobs: build: - - runs-on: ${{ matrix.os }} - + runs-on: '${{ matrix.os }}' strategy: matrix: - os: [ubuntu-22.04] - + os: + - ubuntu-22.04 steps: - name: Context env: - GITHUB_CONTEXT: ${{ toJson(github) }} + GITHUB_CONTEXT: '${{ toJson(github) }}' run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v2 with: fetch-depth: 1 - - name: Use Node.js 18.x uses: actions/setup-node@v1 with: node-version: 18.x - - name: Setup `packer` uses: hashicorp/setup-packer@main with: version: latest - - name: Checkout dbgate/dbgate-pro uses: actions/checkout@v2 with: repository: dbgate/dbgate-pro - token: ${{ secrets.GH_TOKEN }} + token: '${{ secrets.GH_TOKEN }}' path: dbgate-pro - - name: Merge dbgate/dbgate-pro run: | mkdir ../dbgate-pro @@ -53,33 +44,28 @@ jobs: yarn node sync.js --nowatch cd .. - - name: adjustPackageJson run: | cd .. cd dbgate-merged node adjustPackageJson --premium - - name: yarn install run: | cd .. cd dbgate-merged yarn install - - name: setCurrentVersion run: | cd .. cd dbgate-merged yarn setCurrentVersion - - name: printSecrets run: | cd .. cd dbgate-merged yarn printSecrets env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - + GIST_UPLOAD_SECRET: '${{secrets.GIST_UPLOAD_SECRET}}' - name: Prepare packer build run: | cd .. @@ -87,62 +73,48 @@ jobs: yarn run prepare:packer cd packer zip -r cloud-build.zip build - - name: Copy artifacts run: | mkdir artifacts cp ../dbgate-merged/packer/cloud-build.zip artifacts/cloud-build.zip || true - - name: Upload artifacts uses: actions/upload-artifact@v4 with: - name: ${{ matrix.os }} + name: '${{ matrix.os }}' path: artifacts - - name: Release uses: softprops/action-gh-release@v1 - if: startsWith(github.ref, 'refs/tags/') + if: 'startsWith(github.ref, ''refs/tags/'')' with: - files: 'artifacts/**' + files: artifacts/** prerelease: true env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + GITHUB_TOKEN: '${{ secrets.GITHUB_TOKEN }}' - name: Run `packer init` run: | cd ../dbgate-merged/packer packer init ./aws-ubuntu.pkr.hcl env: - AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}} - AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}} - AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}} - + AWS_ACCESS_KEY_ID: '${{secrets.AWS_ACCESS_KEY_ID}}' + AWS_SECRET_ACCESS_KEY: '${{secrets.AWS_SECRET_ACCESS_KEY}}' + AWS_DEFAULT_REGION: '${{secrets.AWS_DEFAULT_REGION}}' - name: Run `packer build` run: | cd ../dbgate-merged/packer packer build ./aws-ubuntu.pkr.hcl env: - AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}} - AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}} - AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}} - - # - name: Install AWS CLI - # run: | - # curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" - # unzip awscliv2.zip - # sudo ./aws/install - # sudo apt-get install jq -y - + AWS_ACCESS_KEY_ID: '${{secrets.AWS_ACCESS_KEY_ID}}' + AWS_SECRET_ACCESS_KEY: '${{secrets.AWS_SECRET_ACCESS_KEY}}' + AWS_DEFAULT_REGION: '${{secrets.AWS_DEFAULT_REGION}}' - name: Install jq run: | sudo apt-get install jq -y - - name: Delete old AMIs run: | cd ../dbgate-merged/packer chmod +x delete-old-amis.sh ./delete-old-amis.sh env: - AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}} - AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}} - AWS_DEFAULT_REGION: ${{secrets.AWS_DEFAULT_REGION}} + AWS_ACCESS_KEY_ID: '${{secrets.AWS_ACCESS_KEY_ID}}' + AWS_SECRET_ACCESS_KEY: '${{secrets.AWS_SECRET_ACCESS_KEY}}' + AWS_DEFAULT_REGION: '${{secrets.AWS_DEFAULT_REGION}}' diff --git a/.github/workflows/build-docker-pro.yaml b/.github/workflows/build-docker-pro.yaml index 146b20246..68b1afc1c 100644 --- a/.github/workflows/build-docker-pro.yaml +++ b/.github/workflows/build-docker-pro.yaml @@ -1,35 +1,29 @@ name: Docker image PREMIUM - -on: +'on': push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' - jobs: build: - - runs-on: ${{ matrix.os }} - + runs-on: '${{ matrix.os }}' strategy: matrix: - os: [ubuntu-22.04] - + os: + - ubuntu-22.04 steps: - name: Context env: - GITHUB_CONTEXT: ${{ toJson(github) }} + GITHUB_CONTEXT: '${{ toJson(github) }}' run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v2 with: fetch-depth: 1 - - name: Docker meta id: meta uses: docker/metadata-action@v4 with: - images: | - dbgate/dbgate-premium + images: dbgate/dbgate-premium flavor: | latest=false tags: | @@ -37,19 +31,16 @@ jobs: type=match,pattern=\d+.\d+.\d+,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} type=raw,value=latest,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} - - name: Use Node.js 18.x uses: actions/setup-node@v1 with: node-version: 18.x - - name: Checkout dbgate/dbgate-pro uses: actions/checkout@v2 with: repository: dbgate/dbgate-pro - token: ${{ secrets.GH_TOKEN }} + token: '${{ secrets.GH_TOKEN }}' path: dbgate-pro - - name: Merge dbgate/dbgate-pro run: | mkdir ../dbgate-pro @@ -61,50 +52,51 @@ jobs: yarn node sync.js --nowatch cd .. - - name: adjustPackageJson run: | cd .. cd dbgate-merged - node adjustPackageJson --premium + node adjustPackageJson --premium - name: yarn install run: | cd .. cd dbgate-merged - yarn install + # yarn --version + # yarn config set network-timeout 300000 + yarn install - name: setCurrentVersion run: | cd .. cd dbgate-merged + yarn setCurrentVersion - - name: printSecrets run: | cd .. cd dbgate-merged - yarn printSecrets + + yarn printSecrets env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + GIST_UPLOAD_SECRET: '${{secrets.GIST_UPLOAD_SECRET}}' - name: Prepare docker image run: | cd .. cd dbgate-merged - yarn run prepare:docker + yarn run prepare:docker - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - + username: '${{ secrets.DOCKER_USERNAME }}' + password: '${{ secrets.DOCKER_PASSWORD }}' - name: Build and push uses: docker/build-push-action@v3 with: push: true context: ../dbgate-merged/docker - tags: ${{ steps.meta.outputs.tags }} - platforms: linux/amd64,linux/arm64 + tags: '${{ steps.meta.outputs.tags }}' + platforms: 'linux/amd64,linux/arm64' diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml index 85737fdd6..5d034c7cd 100644 --- a/.github/workflows/build-docker.yaml +++ b/.github/workflows/build-docker.yaml @@ -1,35 +1,29 @@ -name: Docker image - -on: +name: Docker image Community +'on': push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' - jobs: build: - - runs-on: ${{ matrix.os }} - + runs-on: '${{ matrix.os }}' strategy: matrix: - os: [ubuntu-22.04] - + os: + - ubuntu-22.04 steps: - name: Context env: - GITHUB_CONTEXT: ${{ toJson(github) }} + GITHUB_CONTEXT: '${{ toJson(github) }}' run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v2 with: fetch-depth: 1 - - name: Docker meta id: meta uses: docker/metadata-action@v4 with: - images: | - dbgate/dbgate + images: dbgate/dbgate flavor: | latest=false tags: | @@ -37,7 +31,6 @@ jobs: type=match,pattern=\d+.\d+.\d+,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} type=raw,value=latest,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} - - name: Docker alpine meta id: alpmeta uses: docker/metadata-action@v4 @@ -51,56 +44,53 @@ jobs: type=match,pattern=\d+.\d+.\d+,suffix=-alpine,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} type=raw,value=alpine,enable=${{ !contains(github.ref_name, '-docker.') && !contains(github.ref_name, '-beta.') }} - - name: Use Node.js 18.x uses: actions/setup-node@v1 with: node-version: 18.x - - name: adjustPackageJson run: | - node adjustPackageJson --community + node adjustPackageJson --community - name: yarn install run: | + # yarn --version # yarn config set network-timeout 300000 yarn install - - name: setCurrentVersion run: | + yarn setCurrentVersion - - name: printSecrets run: | - yarn printSecrets + + yarn printSecrets env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} + GIST_UPLOAD_SECRET: '${{secrets.GIST_UPLOAD_SECRET}}' - name: Prepare docker image run: | - yarn run prepare:docker + yarn run prepare:docker - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 - name: Login to DockerHub uses: docker/login-action@v2 with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - + username: '${{ secrets.DOCKER_USERNAME }}' + password: '${{ secrets.DOCKER_PASSWORD }}' - name: Build and push uses: docker/build-push-action@v3 with: push: true context: ./docker - tags: ${{ steps.meta.outputs.tags }} - platforms: linux/amd64,linux/arm64,linux/arm/v7 - + tags: '${{ steps.meta.outputs.tags }}' + platforms: 'linux/amd64,linux/arm64,linux/arm/v7' - name: Build and push alpine uses: docker/build-push-action@v3 with: push: true context: ./docker file: ./docker/Dockerfile-alpine - tags: ${{ steps.alpmeta.outputs.tags }} - platforms: linux/amd64,linux/arm64,linux/arm/v7 + tags: '${{ steps.alpmeta.outputs.tags }}' + platforms: 'linux/amd64,linux/arm64,linux/arm/v7' diff --git a/.github/workflows/build-npm-pro.yaml b/.github/workflows/build-npm-pro.yaml index 154d661c2..aa1d58068 100644 --- a/.github/workflows/build-npm-pro.yaml +++ b/.github/workflows/build-npm-pro.yaml @@ -1,31 +1,20 @@ name: NPM packages PREMIUM - -# on: [push] - -on: +'on': push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' - -# on: -# push: -# branches: -# - production - jobs: build: - - runs-on: ${{ matrix.os }} - + runs-on: '${{ matrix.os }}' strategy: matrix: - os: [ubuntu-22.04] - + os: + - ubuntu-22.04 steps: - name: Context env: - GITHUB_CONTEXT: ${{ toJson(github) }} + GITHUB_CONTEXT: '${{ toJson(github) }}' run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v2 with: @@ -34,14 +23,12 @@ jobs: uses: actions/setup-node@v1 with: node-version: 18.x - - name: Checkout dbgate/dbgate-pro uses: actions/checkout@v2 with: repository: dbgate/dbgate-pro - token: ${{ secrets.GH_TOKEN }} + token: '${{ secrets.GH_TOKEN }}' path: dbgate-pro - - name: Merge dbgate/dbgate-pro run: | mkdir ../dbgate-pro @@ -53,65 +40,55 @@ jobs: yarn node sync.js --nowatch cd .. - - name: adjustNpmPackageJsonPremium run: | cd .. cd dbgate-merged node adjustNpmPackageJsonPremium - - name: Configure NPM token env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TOKEN: '${{ secrets.NPM_TOKEN }}' run: | cd .. cd dbgate-merged npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" - - name: Remove dbmodel - should be not published run: | cd .. cd dbgate-merged rm -rf packages/dbmodel - - name: yarn install run: | cd .. cd dbgate-merged yarn install - - name: setCurrentVersion run: | cd .. cd dbgate-merged yarn setCurrentVersion - - name: printSecrets run: | cd .. cd dbgate-merged yarn printSecrets env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - + GIST_UPLOAD_SECRET: '${{secrets.GIST_UPLOAD_SECRET}}' - name: Publish dbgate-api-premium run: | cd .. cd dbgate-merged/packages/api npm publish - - name: Publish dbgate-web-premium run: | cd .. cd dbgate-merged/packages/web npm publish - - name: Publish dbgate-serve-premium run: | cd .. cd dbgate-merged/packages/serve npm publish - - name: Publish dbgate-plugin-cosmosdb run: | cd .. diff --git a/.github/workflows/build-npm.yaml b/.github/workflows/build-npm.yaml index 44e5e1d6e..b2237af86 100644 --- a/.github/workflows/build-npm.yaml +++ b/.github/workflows/build-npm.yaml @@ -1,31 +1,20 @@ name: NPM packages - -# on: [push] - -on: +'on': push: tags: - 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+' - -# on: -# push: -# branches: -# - production - jobs: build: - - runs-on: ${{ matrix.os }} - + runs-on: '${{ matrix.os }}' strategy: matrix: - os: [ubuntu-22.04] - + os: + - ubuntu-22.04 steps: - name: Context env: - GITHUB_CONTEXT: ${{ toJson(github) }} + GITHUB_CONTEXT: '${{ toJson(github) }}' run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v2 with: @@ -34,37 +23,30 @@ jobs: uses: actions/setup-node@v1 with: node-version: 18.x - - name: Configure NPM token env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TOKEN: '${{ secrets.NPM_TOKEN }}' run: | npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" - - name: yarn install run: | yarn install - - name: setCurrentVersion run: | yarn setCurrentVersion - - name: printSecrets run: | - yarn printSecrets + yarn printSecrets env: - GIST_UPLOAD_SECRET : ${{secrets.GIST_UPLOAD_SECRET}} - + GIST_UPLOAD_SECRET: '${{secrets.GIST_UPLOAD_SECRET}}' - name: Publish types working-directory: packages/types run: | npm publish - - name: Publish tools working-directory: packages/tools run: | npm publish - - name: Publish sqltree working-directory: packages/sqltree run: | @@ -74,82 +56,66 @@ jobs: working-directory: packages/api run: | npm publish - - name: Publish datalib working-directory: packages/datalib run: | npm publish - - name: Publish filterparser working-directory: packages/filterparser run: | npm publish - - name: Publish web working-directory: packages/web run: | npm publish - - name: Publish dbgate-serve working-directory: packages/serve run: | npm publish - - name: Publish dbmodel working-directory: packages/dbmodel run: | npm publish - - name: Publish dbgate-plugin-csv working-directory: plugins/dbgate-plugin-csv run: | npm publish - - name: Publish dbgate-plugin-xml working-directory: plugins/dbgate-plugin-xml run: | npm publish - - name: Publish dbgate-plugin-excel working-directory: plugins/dbgate-plugin-excel run: | npm publish - - name: Publish dbgate-plugin-mssql working-directory: plugins/dbgate-plugin-mssql run: | npm publish - - name: Publish dbgate-plugin-mysql working-directory: plugins/dbgate-plugin-mysql run: | npm publish - - name: Publish dbgate-plugin-mongo working-directory: plugins/dbgate-plugin-mongo run: | npm publish - - name: Publish dbgate-plugin-postgres working-directory: plugins/dbgate-plugin-postgres run: | npm publish - - name: Publish dbgate-plugin-sqlite working-directory: plugins/dbgate-plugin-sqlite run: | npm publish - - name: Publish dbgate-plugin-redis working-directory: plugins/dbgate-plugin-redis run: | npm publish - - name: Publish dbgate-plugin-oracle working-directory: plugins/dbgate-plugin-oracle run: | npm publish - - name: Publish dbgate-plugin-clickhouse working-directory: plugins/dbgate-plugin-clickhouse run: | diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index c813d251e..445674996 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -1,16 +1,14 @@ name: Run tests -on: +'on': push: branches: - master - develop - - 'feature/**' - + - feature/** jobs: test-runner: runs-on: ubuntu-latest - container: node:18 - + container: 'node:18' steps: - name: Install dependencies for cypress run: | @@ -37,7 +35,6 @@ jobs: run: | cd integration-tests yarn test:ci -# yarn wait:ci - name: Filter parser tests if: always() run: | @@ -51,54 +48,42 @@ jobs: - uses: tanmen/jest-reporter@v1 if: always() with: - github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: '${{ secrets.GITHUB_TOKEN }}' result-file: integration-tests/result.json action-name: Integration tests - uses: tanmen/jest-reporter@v1 if: always() with: - github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: '${{ secrets.GITHUB_TOKEN }}' result-file: packages/filterparser/result.json action-name: Filter parser test results - uses: tanmen/jest-reporter@v1 if: always() with: - github-token: ${{ secrets.GITHUB_TOKEN }} + github-token: '${{ secrets.GITHUB_TOKEN }}' result-file: packages/datalib/result.json action-name: Datalib (perspectives) test results - services: postgres: image: postgres env: POSTGRES_PASSWORD: Pwd2020Db - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - + options: '--health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5' mysql: - image: mysql:8.0.18 + image: 'mysql:8.0.18' env: MYSQL_ROOT_PASSWORD: Pwd2020Db - mssql: image: mcr.microsoft.com/mssql/server env: - ACCEPT_EULA: Y + ACCEPT_EULA: 'Y' SA_PASSWORD: Pwd2020Db MSSQL_PID: Express - clickhouse: - image: bitnami/clickhouse:24.8.4 + image: 'bitnami/clickhouse:24.8.4' env: CLICKHOUSE_ADMIN_PASSWORD: Pwd2020Db - oracle: - image: gvenzl/oracle-xe:21-slim + image: 'gvenzl/oracle-xe:21-slim' env: ORACLE_PASSWORD: Pwd2020Db - - # cockroachdb: - # image: cockroachdb/cockroach From 2966484cda2e3f5159102d1a32c44cdf7006c9b3 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Mon, 30 Dec 2024 08:23:36 +0100 Subject: [PATCH 14/15] v6.1.3-beta.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ae7daa17e..c18cf02d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "private": true, - "version": "6.1.2", + "version": "6.1.3-beta.1", "name": "dbgate-all", "workspaces": [ "packages/*", From 0cf3d5993c7c1d5605b12ef3d50c1ccd74cb2ace Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Mon, 30 Dec 2024 08:28:25 +0100 Subject: [PATCH 15/15] generated header --- .github/workflows/build-app-beta.yaml | 3 +++ .github/workflows/build-app-pro-beta.yaml | 3 +++ .github/workflows/build-app-pro.yaml | 3 +++ .github/workflows/build-app.yaml | 3 +++ .github/workflows/build-aws-pro-beta.yaml | 3 +++ .github/workflows/build-docker-pro.yaml | 3 +++ .github/workflows/build-docker.yaml | 3 +++ .github/workflows/build-npm-pro.yaml | 3 +++ .github/workflows/build-npm.yaml | 3 +++ .github/workflows/run-tests.yaml | 3 +++ common/processWorkflows.js | 9 +++++++-- 11 files changed, 37 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-app-beta.yaml b/.github/workflows/build-app-beta.yaml index 6199e55e9..9d10bdeda 100644 --- a/.github/workflows/build-app-beta.yaml +++ b/.github/workflows/build-app-beta.yaml @@ -1,3 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# This file is generated. Do not edit manually +# -------------------------------------------------------------------------------------------- name: Electron app BETA 'on': push: diff --git a/.github/workflows/build-app-pro-beta.yaml b/.github/workflows/build-app-pro-beta.yaml index 61c55d736..5285c9be9 100644 --- a/.github/workflows/build-app-pro-beta.yaml +++ b/.github/workflows/build-app-pro-beta.yaml @@ -1,3 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# This file is generated. Do not edit manually +# -------------------------------------------------------------------------------------------- name: Electron app PREMIUM BETA 'on': push: diff --git a/.github/workflows/build-app-pro.yaml b/.github/workflows/build-app-pro.yaml index 73a0c9067..7529f45b0 100644 --- a/.github/workflows/build-app-pro.yaml +++ b/.github/workflows/build-app-pro.yaml @@ -1,3 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# This file is generated. Do not edit manually +# -------------------------------------------------------------------------------------------- name: Electron app PREMIUM 'on': push: diff --git a/.github/workflows/build-app.yaml b/.github/workflows/build-app.yaml index 231488914..bc4ae305b 100644 --- a/.github/workflows/build-app.yaml +++ b/.github/workflows/build-app.yaml @@ -1,3 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# This file is generated. Do not edit manually +# -------------------------------------------------------------------------------------------- name: Electron app 'on': push: diff --git a/.github/workflows/build-aws-pro-beta.yaml b/.github/workflows/build-aws-pro-beta.yaml index 60250cfb9..2d2e41fdb 100644 --- a/.github/workflows/build-aws-pro-beta.yaml +++ b/.github/workflows/build-aws-pro-beta.yaml @@ -1,3 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# This file is generated. Do not edit manually +# -------------------------------------------------------------------------------------------- name: AWS image PREMIUM 'on': push: diff --git a/.github/workflows/build-docker-pro.yaml b/.github/workflows/build-docker-pro.yaml index 68b1afc1c..a11f32f4e 100644 --- a/.github/workflows/build-docker-pro.yaml +++ b/.github/workflows/build-docker-pro.yaml @@ -1,3 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# This file is generated. Do not edit manually +# -------------------------------------------------------------------------------------------- name: Docker image PREMIUM 'on': push: diff --git a/.github/workflows/build-docker.yaml b/.github/workflows/build-docker.yaml index 5d034c7cd..c6a793945 100644 --- a/.github/workflows/build-docker.yaml +++ b/.github/workflows/build-docker.yaml @@ -1,3 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# This file is generated. Do not edit manually +# -------------------------------------------------------------------------------------------- name: Docker image Community 'on': push: diff --git a/.github/workflows/build-npm-pro.yaml b/.github/workflows/build-npm-pro.yaml index aa1d58068..53b982a59 100644 --- a/.github/workflows/build-npm-pro.yaml +++ b/.github/workflows/build-npm-pro.yaml @@ -1,3 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# This file is generated. Do not edit manually +# -------------------------------------------------------------------------------------------- name: NPM packages PREMIUM 'on': push: diff --git a/.github/workflows/build-npm.yaml b/.github/workflows/build-npm.yaml index b2237af86..6ec677d51 100644 --- a/.github/workflows/build-npm.yaml +++ b/.github/workflows/build-npm.yaml @@ -1,3 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# This file is generated. Do not edit manually +# -------------------------------------------------------------------------------------------- name: NPM packages 'on': push: diff --git a/.github/workflows/run-tests.yaml b/.github/workflows/run-tests.yaml index 445674996..4c7d96b03 100644 --- a/.github/workflows/run-tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -1,3 +1,6 @@ +# -------------------------------------------------------------------------------------------- +# This file is generated. Do not edit manually +# -------------------------------------------------------------------------------------------- name: Run tests 'on': push: diff --git a/common/processWorkflows.js b/common/processWorkflows.js index c40066b8c..5e7c24b35 100644 --- a/common/processWorkflows.js +++ b/common/processWorkflows.js @@ -8,6 +8,11 @@ const outdir = path.resolve(path.join(__dirname, '..', '.github', 'workflows')); const includes = {}; +const HEADER = `# -------------------------------------------------------------------------------------------- +# This file is generated. Do not edit manually +# -------------------------------------------------------------------------------------------- +`; + function readIncludes() { for (const file of fs.readdirSync(indir)) { const text = fs.readFileSync(path.join(indir, file), { encoding: 'utf-8' }); @@ -145,10 +150,10 @@ function processFiles() { }; const converted = processJson(_.omit(json, ['_templates']), args); const out = path.join(outdir, json._templates[key].file); - fs.writeFileSync(out, yaml.dump(converted, dumpOptions)); + fs.writeFileSync(out, HEADER + yaml.dump(converted, dumpOptions)); } } else { - fs.writeFileSync(path.join(outdir, file), yaml.dump(processJson(json), dumpOptions)); + fs.writeFileSync(path.join(outdir, file), HEADER + yaml.dump(processJson(json), dumpOptions)); } } }