Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Set build targets via electron builder config file #2250

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from
Draft
5 changes: 3 additions & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,6 @@ on_failure:
- yarn --version

on_finish:
- ps: if ($env:BUILD_JOB -eq "scenarios_build") { yarn dist:all }

- ps: if ($env:BUILD_JOB -eq "scenarios_build") { yarn dist }
- ps: Push-AppveyorArtifact dist\latest.yml
- ps: Resolve-Path -Path "dist\Cozy[ -]Drive[ -]Setup[ -]*.exe" -Relative | % { Push-AppveyorArtifact $_ }
2 changes: 1 addition & 1 deletion .github/actions/build-and-publish/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ runs:
sudo apt update
sudo apt install --no-install-recommends -y libopenjp2-tools gcc-multilib g++-multilib
fi
yarn dist --x64
yarn dist
10 changes: 10 additions & 0 deletions .github/workflows/linux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,13 @@ jobs:
uses: ./.github/actions/build-and-publish
with:
gh-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Save artifacts
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v3
with:
name: Binaries
path: |
${{ github.workspace }}/dist/latest-linux.yml
${{ github.workspace }}/dist/Cozy[- ]Drive[- ]*.AppImage
retention-days: 5

10 changes: 10 additions & 0 deletions .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,13 @@ jobs:
mac-cert-password: "${{ secrets.mac_cert_password }}"
apple-id: "${{ secrets.apple_id }}"
apple-id-password: "${{ secrets.apple_id_password }}"
- name: Save artifacts
if: ${{ github.event_name == 'pull_request' }}
uses: actions/upload-artifact@v3
with:
name: Binaries
path: |
${{ github.workspace }}/dist/latest-mac.yml
${{ github.workspace }}/dist/Cozy[- ]Drive[- ]*.dmg
retention-days: 5

19 changes: 7 additions & 12 deletions build/afterSignHook.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const path = require('path')
// eslint-disable-next-line node/no-unpublished-require
const electron_notarize = require('electron-notarize')

module.exports = async function(params) {
module.exports = async function (params) {
// Only notarize the app on Mac OS only.
if (process.platform !== 'darwin') {
return
Expand All @@ -27,17 +27,12 @@ module.exports = async function(params) {
// eslint-disable-next-line no-console
console.log(`Notarizing ${appId} found at ${appPath}`)

try {
await electron_notarize.notarize({
appBundleId: appId,
appPath: appPath,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD
})
} catch (error) {
// eslint-disable-next-line no-console
console.error(error)
}
await electron_notarize.notarize({
appBundleId: appId,
appPath: appPath,
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD
})

// eslint-disable-next-line no-console
console.log(`Done notarizing ${appId}`)
Expand Down
19 changes: 15 additions & 4 deletions electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,16 @@ fileAssociations:
description: Cozy Note markdown export
mimeType: 'text/vnd.cozy.note+markdown'
role: Viewer

mac:
hardenedRuntime: true
entitlements: './build/entitlements.mac.inherit.plist'
category: public.app-category.productivity
target:
- dmg
- zip
- target: dmg
arch:
- x64
- arm64
dmg:
contents:
- x: 110
Expand All @@ -50,15 +53,22 @@ dmg:
y: 150
type: link
path: '/Applications'

win:
target:
- nsis
- target: nsis
arch:
- x64
- ia32
# Comment out the following line if the Digicert server starts failing.
# Electron-Builder will then swtich back to the default Comodoca server.
rfc3161TimeStampServer: 'http://timestamp.digicert.com/'

linux:
target:
- AppImage
- target: AppImage
arch:
- x64
category: Network;FileTransfer;
desktop:
StartupNotify: 'true'
Expand All @@ -70,6 +80,7 @@ linux:
services. Your freedom to chose is why you can trust us.
appImage:
artifactName: 'Cozy-Drive-${version}-${arch}.${ext}'

extraResources:
- from: 'build/launcher-script.sh'
to: 'launcher-script.sh'
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"dev:elm": "yarn watch:css & yarn watch:elm & python2 -m SimpleHTTPServer 8000",
"dev:exclusions": "env-cmd -f .env.dev electron ./dev/remote/change-dir-exclusions.js",
"dist": "electron-builder build",
"dist:all": "yarn dist --x64 --ia32",
"docker:exec": "docker exec -it cozy-desktop-stack",
"elm:upgrade": "cd gui && yarn add --dev elm@latest elm-upgrade@latest && elm-upgrade",
"jq": "cross-env HOME=. nice -n 19 jq",
Expand Down Expand Up @@ -101,7 +100,7 @@
"electron-fetch": "1.7.4",
"electron-positioner": "^4.0.0",
"electron-proxy-agent": "1.2.1",
"electron-updater": "^4.1.2",
"electron-updater": "5.0.5",
"fs-extra": "10.0.0",
"isomorphic-fetch": "3.0.0",
"lnk": "^1.1.0",
Expand Down Expand Up @@ -140,10 +139,10 @@
"del": "^6.0.0",
"devtron": "^1.4.0",
"electron": "19.0.0",
"electron-builder": "^22.8.1",
"electron-builder": "^23.3.1",
"electron-download": "^4.1.1",
"electron-mocha": "11.0.2",
"electron-notarize": "^0.1.1",
"electron-notarize": "^1.2.1",
"elm": "^0.19.1",
"elm-format": "0.8.5",
"elm-test": "^0.19.1",
Expand Down
Loading