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

feat: Customize installers #22

Merged
merged 10 commits into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ jobs:
config:
- os: macos-latest-large
arch: x64
- os: macos-latest
arch: arm64
# - os: macos-latest
# arch: arm64
- os: windows-latest
arch: x64

Expand Down Expand Up @@ -89,7 +89,7 @@ jobs:
shell: 'bash'
# Due to this issue https://github.com/electron-userland/electron-builder/issues/6411 the build with npx when rebuilding native dependencies hangs forever
# see https://github.com/cawa-93/vite-electron-builder/pull/953
command: ./node_modules/.bin/electron-builder --config electron-builder.yml --publish ${{ inputs.dry-run && 'never' || 'always' }} --${{ matrix.config.arch }}
command: ./node_modules/.bin/electron-builder --config electron-builder.yml --publish ${{ inputs.dry-run && 'never' || 'always' }}
env:
# Code Signing params
# See https://www.electron.build/code-signing
Expand All @@ -111,16 +111,19 @@ jobs:

# Send the notarization request to the Apple's Notarization service and wait for the result.
echo "Notarize app"
xcrun notarytool submit "dist/Decentraland Launcher-${{ matrix.config.arch }}.dmg" --keychain-profile "notary-profile" --wait
xcrun notarytool submit "dist/Decentraland Launcher-${{ matrix.config.os }}-x64.dmg" --keychain-profile "notary-profile" --wait
xcrun notarytool submit "dist/Decentraland Launcher-${{ matrix.config.os }}-arm64.dmg" --keychain-profile "notary-profile" --wait

# Attach the staple to the executable, this allow the app to be validated by macOS
# even when an internet connection is not available.
echo "Attach staple"
xcrun stapler staple "dist/Decentraland Launcher-${{ matrix.config.arch }}.dmg"
xcrun stapler staple "dist/Decentraland Launcher-${{ matrix.config.os }}-x64.dmg"
xcrun stapler staple "dist/Decentraland Launcher-${{ matrix.config.os }}-arm64.dmg"

# Validate the staple attached to the executable.
echo "Validate staple"
xcrun stapler validate "dist/Decentraland Launcher-${{ matrix.config.arch }}.dmg"
xcrun stapler validate "dist/Decentraland Launcher-${{ matrix.config.os }}-x64.dmg"
xcrun stapler validate "dist/Decentraland Launcher-${{ matrix.config.os }}-arm64.dmg"

- name: Sign Windows Build (exe)
uses: sslcom/esigner-codesign@develop
Expand All @@ -131,7 +134,7 @@ jobs:
password: ${{ secrets.ES_PASSWORD }}
credential_id: ${{ secrets.WINDOWS_CREDENTIAL_ID_SIGNER }}
totp_secret: ${{ secrets.ES_TOTP_SECRET }}
file_path: ${GITHUB_WORKSPACE}/dist/Decentraland Launcher-${{ matrix.config.arch }}.exe
file_path: ${GITHUB_WORKSPACE}/dist/Decentraland Launcher-${{ matrix.config.os }}-${{ matrix.config.arch }}.exe
output_path: ${GITHUB_WORKSPACE}/dist/signed
malware_block: false
environment_name: PROD
Expand All @@ -140,4 +143,4 @@ jobs:
if: ${{github.ref == 'refs/heads/main' && matrix.config.os == 'windows-latest' && !inputs.dry-run}}
shell: pwsh
run: |
Copy-Item -Path "${env:GITHUB_WORKSPACE}\dist\signed\Decentraland Launcher-${{ matrix.config.arch }}.exe" -Destination "${env:GITHUB_WORKSPACE}\dist\Decentraland Launcher-${{ matrix.config.arch }}.exe" -Force
Copy-Item -Path "${env:GITHUB_WORKSPACE}\dist\signed\Decentraland Launcher-${{ matrix.config.os }}-${{ matrix.config.arch }}.exe" -Destination "${env:GITHUB_WORKSPACE}\dist\Decentraland Launcher-${{ matrix.config.os }}-${{ matrix.config.arch }}.exe" -Force
Binary file added buildResources/background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions buildResources/decentraland-deeplink.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@echo off
setlocal

reg add "HKEY_CLASSES_ROOT\decentraland" /ve /t REG_SZ /d "URL: DCL Explorer Protocol" /f
reg add "HKEY_CLASSES_ROOT\decentraland" /v "URL Protocol" /t REG_SZ /d "" /f
reg add "HKEY_CLASSES_ROOT\decentraland\shell" /f
reg add "HKEY_CLASSES_ROOT\decentraland\shell\open" /f
reg add "HKEY_CLASSES_ROOT\decentraland\shell\open\command" /ve /t REG_SZ /d "\"%APPDATA%\DecentralandLauncher\Explorer\latest\Decentraland.exe\" \"%%1\" \"%%2\" \"%%3\"" /f

endlocal
4 changes: 4 additions & 0 deletions buildResources/scripts/windowsInstaller.nsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
!macro customInstall
File /oname=$PLUGINSDIR\decentraland-deeplink.bat "${BUILD_RESOURCES_DIR}\decentraland-deeplink.bat"
ExecWait '"$PLUGINSDIR\decentraland-deeplink.bat"'
!macroend
26 changes: 23 additions & 3 deletions electron-builder.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
productName: Decentraland Launcher
artifactName: "Decentraland Launcher-${arch}.${ext}"
artifactName: "Decentraland Launcher-${os}-${arch}.${ext}"

directories:
output: dist
Expand All @@ -13,20 +13,40 @@ win:
appId: Decentraland.Launcher
icon: buildResources/icon.ico
target:
- nsis
- target: nsis
arch:
- x64
verifyUpdateCodeSignature: false
signAndEditExecutable: false
signingHashAlgorithms:
- sha256
rfc3161TimeStampServer: "http://ts.ssl.com"
timeStampServer: "http://ts.ssl.com"

nsis:
allowElevation: true
allowToChangeInstallationDirectory: true
createDesktopShortcut: true
oneClick: false
perMachine: true
include: buildResources/scripts/windowsInstaller.nsh

mac:
appId: com.Decentraland.Launcher
icon: buildResources/icon.icns
target:
- dmg
- target: default
arch:
- x64
- arm64
hardenedRuntime: true
entitlements: buildResources/entitlements.mac.plist
extendInfo:
- NSMicrophoneUsageDescription: "Need microphone access to use voice chat in the application"

dmg:
title: Decentraland Launcher Installer
background: buildResources/background.png
window:
width: 510
height: 410
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"description": "Launcher to manage Decentraland's apps installation",
"repository": "https://github.com/decentraland/launcher",
"version": "0.0.0-dev",
"author": "Decentraland",
"license": "MIT",
"homepage": "https://github.com/decentraland/launcher#readme",
"type": "module",
"main": "packages/main/dist/index.js",
"scripts": {
Expand Down
19 changes: 6 additions & 13 deletions packages/main/src/ipc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,20 @@ export async function downloadApp(event: Electron.IpcMainInvokeEvent, url: strin
event.sender.send(IPC_EVENTS.INSTALL_STATE, { type: IPC_EVENT_DATA_TYPE.START });

await decompressFile(file.path, branchPath);
fs.symlinkSync(branchPath, EXPLORER_LATEST_VERSION_PATH);

if (getOSName() === PLATFORM.MAC) {
const explorerBinPath = join(branchPath, EXPLORER_MAC_BIN_PATH);
if (fs.existsSync(explorerBinPath)) {
fs.chmodSync(explorerBinPath, 0o755);
}
} else if (getOSName() === PLATFORM.WINDOWS) {
// TODO: Implement permissions for Windows
// const explorerBinPath = join(branchPath, EXPLORER_WIN_BIN_PATH);
// if (fs.existsSync(explorerBinPath)) {
// spawn('cmd.exe', [
// '/c',
// join(EXPLORER_PATH, EXPLORER_REGEDIT_PATH),
// EXPLORER_LATEST_VERSION_PATH,
// ]).on('error', error => {
// log.error(error);
// });
// }
}

if (fs.existsSync(EXPLORER_LATEST_VERSION_PATH)) {
fs.unlinkSync(EXPLORER_LATEST_VERSION_PATH);
}

fs.symlinkSync(branchPath, EXPLORER_LATEST_VERSION_PATH, 'junction');

const versionData = {
version: version,
};
Expand Down
1 change: 1 addition & 0 deletions packages/main/src/mainWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ async function createWindow() {
preload: join(app.getAppPath(), 'packages/preload/dist/index.mjs'),
},
});
browserWindow.setMenuBarVisibility(false);

/**
* If the 'show' property of the BrowserWindow's constructor is omitted from the initialization options,
Expand Down