-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix auto update windows Bug (janhq#1102)
* upgrade electron-updater and electron-builder for fixing windows autoupdater * windows specific target build * Add block map for windows nightly build * content-type blocksize change to application/gzip * content-type blocksize change to application/octet-stream * remove content-type for windows * add custom sign for windows * correct exe file path for binary file * Add windows codesign step to electron-builder --------- Co-authored-by: Service Account <[email protected]> Co-authored-by: Hien To <[email protected]>
- Loading branch information
1 parent
ed04d85
commit 96b00bd
Showing
4 changed files
with
92 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,21 +120,26 @@ jobs: | |
fi | ||
jq --arg version "${VERSION_TAG#v}" '.version = $version' electron/package.json > /tmp/package.json | ||
mv /tmp/package.json electron/package.json | ||
jq '.build.win.sign = "./sign.js"' package.json > /tmp/package.json | ||
mv /tmp/package.json electron/package.json | ||
env: | ||
VERSION_TAG: ${{ steps.tag.outputs.tag }} | ||
|
||
- name: Install AzureSignTool | ||
run: | | ||
dotnet tool install --global AzureSignTool | ||
- name: Build app | ||
run: | | ||
make build | ||
env: | ||
ANALYTICS_ID: ${{ secrets.JAN_APP_POSTHOG_PROJECT_API_KEY }} | ||
ANALYTICS_HOST: ${{ secrets.JAN_APP_POSTHOG_URL }} | ||
|
||
- name: Windows Code Sign with AzureSignTool | ||
run: | | ||
dotnet tool install --global AzureSignTool | ||
cd ./electron/dist | ||
azuresigntool.exe sign -kvu "${{ secrets.AZURE_KEY_VAULT_URI }}" -kvi "${{ secrets.AZURE_CLIENT_ID }}" -kvt "${{ secrets.AZURE_TENANT_ID }}" -kvs "${{ secrets.AZURE_CLIENT_SECRET }}" -kvc ${{ secrets.AZURE_CERT_NAME }} -tr http://timestamp.globalsign.com/tsa/r6advanced1 -v "jan-win-x64-${{ needs.create-draft-release.outputs.version }}.exe" | ||
AZURE_KEY_VAULT_URI: ${{ secrets.AZURE_KEY_VAULT_URI }} | ||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }} | ||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }} | ||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }} | ||
AZURE_CERT_NAME: ${{ secrets.AZURE_CERT_NAME }} | ||
|
||
- uses: actions/[email protected] | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
|
@@ -154,7 +159,7 @@ jobs: | |
upload_url: ${{ needs.create-draft-release.outputs.upload_url }} | ||
asset_path: ./electron/dist/jan-win-x64-${{ needs.create-draft-release.outputs.version }}.exe.blockmap | ||
asset_name: jan-win-x64-${{ needs.create-draft-release.outputs.version }}.exe.blockmap | ||
asset_content_type: text/xml | ||
asset_content_type: application/octet-stream | ||
|
||
- uses: actions/[email protected] | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const { exec } = require('child_process'); | ||
|
||
|
||
function sign({ path, name, certUrl, clientId, tenantId, clientSecret, certName, timestampServer, version }) { | ||
return new Promise((resolve, reject) => { | ||
|
||
const command = `azuresigntool.exe sign -kvu "${certUrl}" -kvi "${clientId}" -kvt "${tenantId}" -kvs "${clientSecret}" -kvc "${certName}" -tr "${timestampServer}" -v "${path}"`; | ||
|
||
|
||
exec(command, (error, stdout, stderr) => { | ||
if (error) { | ||
console.error(`Error: ${error}`); | ||
return reject(error); | ||
} | ||
console.log(`stdout: ${stdout}`); | ||
console.error(`stderr: ${stderr}`); | ||
resolve(); | ||
}); | ||
}); | ||
} | ||
|
||
|
||
exports.default = async function(options) { | ||
|
||
const certUrl = process.env.AZURE_KEY_VAULT_URI; | ||
const clientId = process.env.AZURE_CLIENT_ID; | ||
const tenantId = process.env.AZURE_TENANT_ID; | ||
const clientSecret = process.env.AZURE_CLIENT_SECRET; | ||
const certName = process.env.AZURE_CERT_NAME; | ||
const timestampServer = 'http://timestamp.globalsign.com/tsa/r6advanced1'; | ||
|
||
|
||
await sign({ | ||
path: options.path, | ||
name: "jan-win-x64", | ||
certUrl, | ||
clientId, | ||
tenantId, | ||
clientSecret, | ||
certName, | ||
timestampServer, | ||
version: options.version | ||
}); | ||
}; |