From b151a13f65128809b338b6bc2e75b6ff701b8c5f Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Sat, 22 May 2021 10:36:43 +0200 Subject: [PATCH] mac build --- .github/workflows/build-app-beta.yaml | 8 ++++++++ app/package.json | 6 +++++- app/setMacPlatform.js | 8 ++++++++ package.json | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 app/setMacPlatform.js diff --git a/.github/workflows/build-app-beta.yaml b/.github/workflows/build-app-beta.yaml index e28f0fd6..f901d316 100644 --- a/.github/workflows/build-app-beta.yaml +++ b/.github/workflows/build-app-beta.yaml @@ -42,6 +42,7 @@ jobs: if: matrix.os == 'ubuntu-18.04' uses: samuelmeuli/action-snapcraft@v1 - name: Publish + if: matrix.os != 'macOS-10.15' run: | yarn run build:app env: @@ -49,6 +50,13 @@ jobs: WIN_CSC_LINK: ${{ secrets.WINCERT_CERTIFICATE }} WIN_CSC_KEY_PASSWORD: ${{ secrets.WINCERT_PASSWORD }} + - name: Publish Mac + if: matrix.os == 'macOS-10.15' + run: | + yarn run build:app:mac + env: + GH_TOKEN: ${{ secrets.GH_TOKEN }} # token for electron publish + - name: Save snap login if: matrix.os == 'ubuntu-18.04' run: 'echo "$SNAPCRAFT_LOGIN" > snapcraft.login' diff --git a/app/package.json b/app/package.json index 17edc8f3..4c2fd71d 100644 --- a/app/package.json +++ b/app/package.json @@ -26,7 +26,10 @@ ], "target": { "target": "default", - "arch": "x64" + "arch": [ + "arm64", + "x64" + ] } }, "linux": { @@ -85,6 +88,7 @@ "start:local": "cross-env electron .", "dist": "electron-builder", "build": "cd ../packages/api && yarn build && cd ../web && yarn build && cd ../../app && yarn dist", + "build:mac": "cd ../packages/api && yarn build && cd ../web && yarn build && cd ../../app && node setMacPlatform x64 && yarn dist && node setMacPlatform arm64 && yarn dist", "build:local": "cd ../packages/api && yarn build && cd ../web && yarn build && cd ../../app && yarn predist", "postinstall": "electron-builder install-app-deps && patch-package", "predist": "copyfiles ../packages/api/dist/* packages && copyfiles \"../packages/web/public/*\" packages && copyfiles \"../packages/web/public/**/*\" packages && copyfiles --up 3 \"../plugins/dist/**/*\" packages/plugins" diff --git a/app/setMacPlatform.js b/app/setMacPlatform.js new file mode 100644 index 00000000..ccf644ef --- /dev/null +++ b/app/setMacPlatform.js @@ -0,0 +1,8 @@ +const fs = require('fs'); + +const text = fs.readFileSync('package.json', { encoding: 'utf-8' }); +const json = JSON.parse(text); + +json.build.mac.target.arch = process.argv[2]; + +fs.writeFileSync('package.json', JSON.stringify(json, null, 2), { encoding: 'utf-8' }); diff --git a/package.json b/package.json index f9e3e8f4..c91ca118 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "build:tools": "yarn workspace dbgate-tools build", "build:lib": "yarn build:tools && yarn build:sqltree && yarn build:filterparser && yarn build:datalib", "build:app": "yarn plugins:copydist && cd app && yarn install && yarn build", + "build:app:mac": "yarn plugins:copydist && cd app && yarn install && yarn build:mac", "build:api": "yarn workspace dbgate-api build", "build:web:docker": "yarn workspace dbgate-web build", "build:plugins:frontend": "workspaces-run --only=\"dbgate-plugin-*\" -- yarn build:frontend",