mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +00:00
workflows - defs support
This commit is contained in:
@@ -27,7 +27,7 @@ let modified = false;
|
|||||||
|
|
||||||
function conditionMatch(condition, args) {
|
function conditionMatch(condition, args) {
|
||||||
if (_.isString(condition)) {
|
if (_.isString(condition)) {
|
||||||
return args.key == condition;
|
return args.defs.includes(condition);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -68,9 +68,14 @@ function processJsonStep(json, args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_.isPlainObject(value)) {
|
if (_.isPlainObject(value)) {
|
||||||
if (_.intersection(args.allNames ?? [], Object.keys(value))?.length > 0) {
|
if (_.intersection(args.allDefs ?? [], Object.keys(value))?.length > 0) {
|
||||||
modified = true;
|
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) {
|
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) {
|
for (const key in json._templates) {
|
||||||
const allNames = Object.keys(json._templates);
|
|
||||||
const args = {
|
const args = {
|
||||||
key,
|
defs: [key, ...(json._templates[key]?.defs ?? [])],
|
||||||
replace: json._templates[key]?.replace,
|
replace: json._templates[key]?.replace,
|
||||||
stringReplace: json._templates[key]?.['string-replace'],
|
stringReplace: json._templates[key]?.['string-replace'],
|
||||||
allNames,
|
allDefs,
|
||||||
};
|
};
|
||||||
const converted = processJson(_.omit(json, ['_templates']), args);
|
const converted = processJson(_.omit(json, ['_templates']), args);
|
||||||
const out = path.join(outdir, json._templates[key].file);
|
const out = path.join(outdir, json._templates[key].file);
|
||||||
|
|||||||
198
workflow-templates/build-app.tpl.yaml
Normal file
198
workflow-templates/build-app.tpl.yaml
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
_templates:
|
||||||
|
_community_beta:
|
||||||
|
file: build-app-beta.yaml
|
||||||
|
defs:
|
||||||
|
- _community
|
||||||
|
- _beta
|
||||||
|
string-replace:
|
||||||
|
"<<cd_merged>>": ''
|
||||||
|
"<<adjust>>": '--community'
|
||||||
|
_community_stable:
|
||||||
|
file: build-app.yaml
|
||||||
|
defs:
|
||||||
|
- _community
|
||||||
|
- _stable
|
||||||
|
string-replace:
|
||||||
|
"<<cd_merged>>": ''
|
||||||
|
"<<adjust>>": '--community'
|
||||||
|
|
||||||
|
_premium_beta:
|
||||||
|
file: build-app-pro-beta.yaml
|
||||||
|
defs:
|
||||||
|
- _premium
|
||||||
|
- _beta
|
||||||
|
string-replace:
|
||||||
|
"<<cd_merged>>": |
|
||||||
|
cd ..
|
||||||
|
cd dbgate-merged
|
||||||
|
"<<adjust>>": '--premium'
|
||||||
|
_premium_stable:
|
||||||
|
file: build-app-pro.yaml
|
||||||
|
defs:
|
||||||
|
- _premium
|
||||||
|
- _stable
|
||||||
|
string-replace:
|
||||||
|
"<<cd_merged>>": |
|
||||||
|
cd ..
|
||||||
|
cd dbgate-merged
|
||||||
|
"<<adjust>>": '--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 }}
|
||||||
@@ -3,14 +3,14 @@ _templates:
|
|||||||
file: build-docker.yaml
|
file: build-docker.yaml
|
||||||
string-replace:
|
string-replace:
|
||||||
"<<cd_merged>>": ''
|
"<<cd_merged>>": ''
|
||||||
"<<name>>": community
|
"<<adjust>>": '--community'
|
||||||
_premium:
|
_premium:
|
||||||
file: build-docker-pro.yaml
|
file: build-docker-pro.yaml
|
||||||
string-replace:
|
string-replace:
|
||||||
"<<cd_merged>>": |
|
"<<cd_merged>>": |
|
||||||
cd ..
|
cd ..
|
||||||
cd dbgate-merged
|
cd dbgate-merged
|
||||||
"<<name>>": premium
|
"<<adjust>>": '--premium'
|
||||||
|
|
||||||
name:
|
name:
|
||||||
_community: Docker image Community
|
_community: Docker image Community
|
||||||
@@ -81,7 +81,7 @@ jobs:
|
|||||||
- name: adjustPackageJson
|
- name: adjustPackageJson
|
||||||
run: |
|
run: |
|
||||||
<<cd_merged>>
|
<<cd_merged>>
|
||||||
node adjustPackageJson --<<name>>
|
node adjustPackageJson <<adjust>>
|
||||||
|
|
||||||
- name: yarn install
|
- name: yarn install
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user