Skip to content

Commit 30bf62e

Browse files
committed
Merge branch 'main' into release
2 parents 0a6605e + cc28b58 commit 30bf62e

24 files changed

+604
-316
lines changed

.github/pull_request_template.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### Summary
2+
3+
4+
### TODO:
5+
- [ ] CHANGELOG mentions all code changes.

.github/workflows/release.yaml

Lines changed: 22 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,25 @@ jobs:
4343
run: |
4444
yarn setup
4545
46-
- name: Retrieve version
47-
run: |
48-
echo "Retrieved App version: $(node -p -e "require('./package.json').version")"
49-
echo "APP_VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_OUTPUT
50-
id: version
46+
- name: Read kangaroo config
5147
shell: bash
52-
53-
- name: Retrieve appId
48+
id: kangarooConfig
5449
run: |
50+
echo "APP_VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_OUTPUT
5551
echo "APP_ID=$(node ./scripts/read-app-id.js)" >> $GITHUB_OUTPUT
56-
id: appId
57-
shell: bash
58-
59-
- name: Retrieve whether Windows code signing should be attempted
60-
run: |
52+
echo "MACOS_CODE_SIGNING=$(node ./scripts/read-macos-code-signing.js)" >> $GITHUB_OUTPUT
6153
echo "WINDOWS_CODE_SIGNING=$(node ./scripts/read-windows-code-signing.js)" >> $GITHUB_OUTPUT
62-
id: shouldWindowsCodeSign
63-
shell: bash
6454
65-
- name: Retrieve whether macOS code signing should be attempted
66-
run: |
67-
echo "MACOS_CODE_SIGNING=$(node ./scripts/read-macos-code-signing.js)" >> $GITHUB_OUTPUT
68-
id: shouldMacOSCodeSign
55+
- name: Check that webhapp is available in pouch folder
6956
shell: bash
57+
run: |
58+
if ! ls ./pouch/*.webhapp 1>/dev/null 2>&1; then
59+
echo "Error: No .webhapp file found in ./pouch folder. Make sure to specify a URL to your webhapp in kangaroo.config.ts or commit the webhapp to git."
60+
exit 1
61+
fi
7062
7163
- name: Setup for macOS code signing
72-
if: (matrix.platform == 'macos-13' || matrix.platform == 'macos-latest') && steps.shouldMacOSCodeSign.outputs.MACOS_CODE_SIGNING == 'true'
64+
if: (matrix.platform == 'macos-13' || matrix.platform == 'macos-latest') && steps.kangarooConfig.outputs.MACOS_CODE_SIGNING == 'true'
7365
uses: matthme/import-codesign-certs@5565bb656f60c98c8fc515f3444dd8db73545dc2
7466
with:
7567
p12-file-base64: ${{ secrets.HBE_APPLE_CERTIFICATE_BASE64 }}
@@ -78,7 +70,7 @@ jobs:
7870
# macOS WITHOUT code signing
7971
#---------------------------------------------------------------------------------------
8072
- name: build and upload the app WITHOUT code signing (macOS x86)
81-
if: matrix.platform == 'macos-13' && steps.shouldMacOSCodeSign.outputs.MACOS_CODE_SIGNING == 'false'
73+
if: matrix.platform == 'macos-13' && steps.kangarooConfig.outputs.MACOS_CODE_SIGNING == 'false'
8274
env:
8375
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8476
CSC_IDENTITY_AUTO_DISCOVERY: false
@@ -87,7 +79,7 @@ jobs:
8779
ls dist
8880
8981
- name: build and upload the app WITHOUT code signing (macOS arm64)
90-
if: matrix.platform == 'macos-latest' && steps.shouldMacOSCodeSign.outputs.MACOS_CODE_SIGNING == 'false'
82+
if: matrix.platform == 'macos-latest' && steps.kangarooConfig.outputs.MACOS_CODE_SIGNING == 'false'
9183
env:
9284
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9385
CSC_IDENTITY_AUTO_DISCOVERY: false
@@ -99,7 +91,7 @@ jobs:
9991
#---------------------------------------------------------------------------------------
10092
# Note this issue regarding the if condition: https://github.com/actions/runner/issues/1173
10193
- name: build and upload the app WITH code signing (macOS x86)
102-
if: matrix.platform == 'macos-13' && steps.shouldMacOSCodeSign.outputs.MACOS_CODE_SIGNING == 'true'
94+
if: matrix.platform == 'macos-13' && steps.kangarooConfig.outputs.MACOS_CODE_SIGNING == 'true'
10395
env:
10496
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10597
APPLE_DEV_IDENTITY: ${{ secrets.APPLE_DEV_IDENTITY }}
@@ -112,7 +104,7 @@ jobs:
112104
ls dist
113105
114106
- name: build and upload the app WITH code signing (macOS arm64)
115-
if: matrix.platform == 'macos-latest' && steps.shouldMacOSCodeSign.outputs.MACOS_CODE_SIGNING == 'true'
107+
if: matrix.platform == 'macos-latest' && steps.kangarooConfig.outputs.MACOS_CODE_SIGNING == 'true'
116108
env:
117109
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118110
APPLE_DEV_IDENTITY: ${{ secrets.APPLE_DEV_IDENTITY }}
@@ -136,8 +128,8 @@ jobs:
136128
137129
# Modify the postinst script of the .deb file
138130
node ./scripts/extend-deb-postinst.mjs
139-
gh release upload "v${{ steps.version.outputs.APP_VERSION }}" "latest-linux.yml" --clobber
140-
gh release upload "v${{ steps.version.outputs.APP_VERSION }}" "dist/${{ steps.appId.outputs.APP_ID }}_${{ steps.version.outputs.APP_VERSION }}_amd64.deb" --clobber
131+
gh release upload "v${{ steps.kangarooConfig.outputs.APP_VERSION }}" "latest-linux.yml" --clobber
132+
gh release upload "v${{ steps.kangarooConfig.outputs.APP_VERSION }}" "dist/${{ steps.kangarooConfig.outputs.APP_ID }}_${{ steps.kangarooConfig.outputs.APP_VERSION }}_amd64.deb" --clobber
141133
142134
# Windows
143135
#---------------------------------------------------------------------------------------
@@ -159,15 +151,15 @@ jobs:
159151
# Sign the .exe file
160152
dotnet tool install --global --version 4.0.1 AzureSignTool
161153
echo "sha512 before code signing"
162-
CertUtil -hashfile "dist/${{ steps.appId.outputs.APP_ID }}-${{ steps.version.outputs.APP_VERSION }}-setup.exe" SHA512
163-
AzureSignTool 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.digicert.com -v "dist/${{ steps.appId.outputs.APP_ID }}-${{ steps.version.outputs.APP_VERSION }}-setup.exe"
154+
CertUtil -hashfile "dist/${{ steps.kangarooConfig.outputs.APP_ID }}-${{ steps.kangarooConfig.outputs.APP_VERSION }}-setup.exe" SHA512
155+
AzureSignTool 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.digicert.com -v "dist/${{ steps.kangarooConfig.outputs.APP_ID }}-${{ steps.kangarooConfig.outputs.APP_VERSION }}-setup.exe"
164156
echo "sha512 after code signing"
165-
CertUtil -hashfile "dist/${{ steps.appId.outputs.APP_ID }}-${{ steps.version.outputs.APP_VERSION }}-setup.exe" SHA512
157+
CertUtil -hashfile "dist/${{ steps.kangarooConfig.outputs.APP_ID }}-${{ steps.kangarooConfig.outputs.APP_VERSION }}-setup.exe" SHA512
166158
167159
# Overwrite the latest.yml one with one containing the sha512 of the code signed .exe file
168160
node ./scripts/latest-yaml.js
169-
gh release upload "v${{ steps.version.outputs.APP_VERSION }}" "latest.yml" --clobber
170-
gh release upload "v${{ steps.version.outputs.APP_VERSION }}" "dist/${{ steps.appId.outputs.APP_ID }}-${{ steps.version.outputs.APP_VERSION }}-setup.exe" --clobber
161+
gh release upload "v${{ steps.kangarooConfig.outputs.APP_VERSION }}" "latest.yml" --clobber
162+
gh release upload "v${{ steps.kangarooConfig.outputs.APP_VERSION }}" "dist/${{ steps.kangarooConfig.outputs.APP_ID }}-${{ steps.kangarooConfig.outputs.APP_VERSION }}-setup.exe" --clobber
171163
172164
fi
173165

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
## \[Unreleased\]
2+
3+
### Added
4+
### Fixed
5+
### Changed
6+
- Updated to holochain 0.5.0-rc.1
7+
### Removed

README.md

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ This repository let's you easily convert your Holochain app into a standalone, e
1111
Depending on which Holochain minor version you want to use you should use the corresponding branch of this repository.
1212

1313

14-
- Holochain 0.4.x (stable): [main](https://github.com/holochain/kangaroo-electron/tree/main)
14+
- Holochain 0.4.x (stable): [main-0.4](https://github.com/holochain/kangaroo-electron/tree/main-0.4)
15+
- Holochain 0.5.x: [main](https://github.com/holochain/kangaroo-electron/tree/main)
1516
- Holochain 0.3.x: [main-0.3](https://github.com/holochain/kangaroo-electron/tree/main-0.3)
1617

1718
# Instructions
@@ -21,14 +22,14 @@ Depending on which Holochain minor version you want to use you should use the co
2122
1. Either use this repository as a template (by clicking on the green "Use this template" button) or fork it.
2223
Using it as a template allows you to start with a clean git history and the contributors of this repository won't show up as contributors to your new repository. **Forking has the advantage of being able to relatively easily pull in updates from this parent repository at a later point in time.** If you fork it, it may be smart to work off a different branch than the main branch in your forked repository in order to be able to keep the main branch in sync with this parent repository and selectively merge into your working branch as needed.
2324

24-
2. In your local copy of the repository, run
25+
2. In the `kangaroo.config.ts` file, replace the `appId` and `productName` fields with names appropriate for your own app.
26+
27+
3. In your local copy of the repository, run
2528

2629
```
2730
yarn setup
2831
```
2932

30-
3. In the `kangaroo.config.ts` file, replace the `appId` and `productName` fields with names appropriate for your own app.
31-
3233
4. Choose a version number in the `version` field of `kangaroo.config.ts`. And **Read** the section [Versioning](#Versioning) below to understand the implications.
3334

3435
5. Paste the `.webhapp` file of your holochain app into the `pouch` folder.
@@ -42,6 +43,18 @@ yarn dev
4243

4344
## Build the Distributable
4445

46+
> [!WARNING]
47+
> The default bootstrap, signaling and ICE servers (used for connection establishment among peers)
48+
> in `kangaroo.config.ts` have no availability guarantees whatsoever and are meant for testing
49+
> purposes only.
50+
>
51+
> If you want to deploy your app to end-users, make sure to run your own
52+
> instances of these servers or use servers that have guaranteed availability for the lifetime
53+
> of your app's network(s).
54+
>
55+
> **Changing these URLs *after* deployment of your app can result in a network partition**.
56+
57+
4558
### Build locally
4659

4760
To build the app locally for your platform, run the build command for your respecive platform:
@@ -60,9 +73,13 @@ yarn build:windows
6073

6174
The general workflow goes as follows:
6275

63-
1. Create a draft release on github and set its "Tag verion" to the value of the `version` field that you chose in `kangaroo.config.ts` and prefix it with `v`, for example `v0.1.0`.
76+
1. Make sure that CI has access to your app's .webhapp file by either
77+
- specifying the `webhapp` field in `kangaroo.config.ts` pointing to a URL where CI can fetch it and a sha256 to verify its integrity
78+
- remove `pouch/*.webhapp` from the `.gitignore` file and commit your .webhapp to git.
79+
80+
2. Create a draft release on github and set its "Tag verion" to the value of the `version` field that you chose in `kangaroo.config.ts` and prefix it with `v`, for example `v0.1.0`.
6481

65-
2. Merge the main branch into the release branch and push it to github to trigger the release workflow.
82+
3. Merge the main branch into the release branch and push it to github to trigger the release workflow.
6683

6784
If you do this for the first time you will need to create the `release` branch first:
6885

@@ -154,7 +171,7 @@ Options:
154171
--holochain-wasm-log <string> WASM_LOG value to pass to the holochain binary
155172
--lair-rust-log <string> RUST_LOG value to pass to the lair keystore binary
156173
-b, --bootstrap-url <url> URL of the bootstrap server to use (not persisted across restarts).
157-
-s, --signaling-url <url> URL of the signaling server to use (not persisted across restarts).
174+
-s, --signal-url <url> URL of the signaling server to use (not persisted across restarts).
158175
--ice-urls <string> Comma separated string of ICE server URLs to use. Is ignored if an external holochain binary is being used
159176
(not persisted across restarts).
160177
--print-holochain-logs Print holochain logs directly to the terminal (they will be still written to the logfile as well)

kangaroo.config.ts

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,31 @@ export default defineConfig({
99
fallbackToIndexHtml: true,
1010
autoUpdates: true,
1111
systray: true,
12-
passwordMode: 'no-password',
12+
passwordMode: 'password-optional',
13+
bootstrapUrl: 'https://dev-test-bootstrap2.holochain.org/',
14+
signalUrl: 'wss://dev-test-bootstrap2.holochain.org/',
15+
iceUrls: ['stun:stun.l.google.com:19302', 'stun:stun.cloudflare.com:3478'],
1316
bins: {
1417
holochain: {
15-
version: '0.4.1',
18+
version: '0.5.2',
1619
sha256: {
1720
'x86_64-unknown-linux-gnu':
18-
'ee713408a31d2e17826b18e2eaea0b3e200b42aa0cc8e3562c899b0b5ebcaa0c',
21+
'bbbdb2e52693522eaaaddafd392c9861db19210e02a48e1ff80d1077a296a08e',
1922
'x86_64-pc-windows-msvc.exe':
20-
'9aa248f6e500915085ebf3fd093541cbbdad59a994e7f904260cb4ad788bd1e3',
21-
'x86_64-apple-darwin': '0ce19dfde7db6521cd96e2fef924c62d319d204e7f79bc0379674a7a6122c74f',
22-
'aarch64-apple-darwin': '74dc8d8529a50d24e8338ddd2e9913d6fb34414f6588d11243e6ccb29feda029',
23+
'e111298fc3af3cc12bfc7adb742d5f29ced7d19f05267969a23d0b8e0d286d5c',
24+
'x86_64-apple-darwin': '8bde56c485154b9ac31aa8a5c7232479503b6015fccf66035228b52680e2daf5',
25+
'aarch64-apple-darwin': '3b6da6df698d86e5d66691b0c91c5ff0e308b07a400b7ea733f019ea62021cdd',
2326
},
2427
},
2528
lair: {
26-
version: '0.5.3',
29+
version: '0.6.1',
2730
sha256: {
2831
'x86_64-unknown-linux-gnu':
29-
'96a28b9b37c73ef46d8b5c56b9d799d558fd2fe77b41c577e2bcb37685a46396',
32+
'c5d5d912af41f17def1c9d1027abd8eb6ce6f088871f4347ed38e124a93023cc',
3033
'x86_64-pc-windows-msvc.exe':
31-
'68b6453a19921072aac04dae52a4e94e725e7482005d2f54f907aec680e078de',
32-
'x86_64-apple-darwin': 'a53bfb8e501431870b99243cbac24f6103d67f8be094930f174829bb249f34c4',
33-
'aarch64-apple-darwin': '6b15d977408847ac977c2e060c7aab84a69e6e90c79390098dd40a6b75256e50',
34+
'e11a0658c2d5a3c00409ea447241b3f1f3a215d70fa396b8a3ed633226f0a11f',
35+
'x86_64-apple-darwin': 'fed0e9c3fc32589031229fb177ef3b3324e0096e742802898976812174bdd12d',
36+
'aarch64-apple-darwin': 'dd36c33e495b8046501f0824fbc08f069973cab5ee210275ab9de3af932d79e8',
3437
},
3538
},
3639
},

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
"main": "./out/main/index.js",
66
"scripts": {
77
"dev": "yarn write:configs && yarn pouch:unpack && yarn create:icons && electron-vite dev",
8-
"setup": "yarn && yarn fetch:binaries && yarn write:configs",
8+
"setup": "yarn && yarn fetch:binaries && yarn fetch:webhapp && yarn write:configs",
99
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
1010
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
1111
"typecheck": "yarn typecheck:node && yarn typecheck:web",
1212
"fetch:binaries": "node ./scripts/fetch-binaries.js",
13+
"fetch:webhapp": "node ./scripts/fetch-webhapp.js",
1314
"pouch:unpack": "node ./scripts/unpack-pouch.js",
1415
"create:icons": "node ./scripts/create-icons.js",
15-
"write:configs": "node ./scripts/write-builder-config.js",
16+
"write:configs": "node ./scripts/write-configs.js",
1617
"build": "yarn write:configs && yarn pouch:unpack && yarn create:icons && yarn typecheck && electron-vite build",
1718
"build:win": "yarn build && electron-builder --win --config",
1819
"build:mac-arm64": "yarn build && electron-builder --mac --arm64 --config",
@@ -23,16 +24,17 @@
2324
"dependencies": {
2425
"@electron-toolkit/preload": "^3.0.1",
2526
"@electron-toolkit/utils": "^3.0.0",
26-
"@holochain/client": "0.18.0-rc.1",
27-
"@holochain/hc-spin-rust-utils": "0.400.0",
28-
"@lightningrodlabs/we-rust-utils": "0.400.1",
27+
"@holochain/client": "0.19.0-rc.0",
28+
"@holochain/hc-spin-rust-utils": "0.500.0-rc.0",
2929
"@matthme/electron-updater": "6.3.0-alpha.1",
3030
"@msgpack/msgpack": "^2.8.0",
3131
"adm-zip": "0.5.14",
3232
"bufferutil": "4.0.8",
3333
"commander": "12.1.0",
3434
"electron-context-menu": "3.6.1",
3535
"get-port": "7.0.0",
36+
"js-sha512": "^0.9.0",
37+
"js-yaml": "4.1.0",
3638
"nanoid": "5.0.4",
3739
"semver": "^7.6.2",
3840
"split": "1.0.1",
@@ -51,7 +53,6 @@
5153
"eslint": "^8.0.1",
5254
"eslint-plugin-import": "^2.25.0",
5355
"jimp": "^1.6.0",
54-
"js-yaml": "4.1.0",
5556
"make-dir-cli": "^3.1.0",
5657
"ncp": "^2.0.0",
5758
"octokit": "4.0.2",

scripts/download.js

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* eslint-disable @typescript-eslint/no-var-requires */
2+
const childProcess = require('child_process');
3+
const crypto = require('crypto');
4+
const fs = require('fs');
5+
6+
7+
function downloadFile(url, targetPath, expectedSha256Hex, chmod = false) {
8+
console.log('Downloading from ', url);
9+
childProcess.exec(`curl -f -L --output ${targetPath} ${url}`, (error, stdout, stderr) => {
10+
console.log(stdout);
11+
console.log(stderr);
12+
if (error !== null) {
13+
console.log('exec error: ' + error);
14+
throw new Error('Failed to fetch resource.');
15+
} else {
16+
const fileBytes = fs.readFileSync(targetPath);
17+
const hasher = crypto.createHash('sha256');
18+
hasher.update(fileBytes);
19+
const sha256Hex = hasher.digest('hex');
20+
if (sha256Hex !== expectedSha256Hex)
21+
throw new Error(
22+
`sha256 does not match the expected sha256. Got ${sha256Hex} but expected ${expectedSha256Hex}`
23+
);
24+
25+
console.log('Download successful. sha256 of file (hex): ', sha256Hex);
26+
if (chmod) {
27+
fs.chmodSync(targetPath, 511);
28+
console.log('Gave executable permission to file.');
29+
}
30+
}
31+
});
32+
}
33+
34+
module.exports = downloadFile;

scripts/fetch-binaries.js

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/* eslint-disable @typescript-eslint/no-var-requires */
22
const fs = require('fs');
33
const path = require('path');
4-
const crypto = require('crypto');
54
const tsNode = require('ts-node');
6-
const childProcess = require('child_process');
5+
const downloadFile = require('./download');
76

87
tsNode.register();
98

@@ -46,33 +45,6 @@ const lairBinaryFilename = `lair-keystore-v${kangarooConfig.bins.lair.version}-$
4645
process.platform === 'win32' ? '.exe' : ''
4746
}`;
4847

49-
function downloadFile(url, targetPath, expectedSha256Hex, chmod = false) {
50-
console.log('Downloading from ', url);
51-
childProcess.exec(`curl -f -L --output ${targetPath} ${url}`, (error, stdout, stderr) => {
52-
console.log(stdout);
53-
console.log(stderr);
54-
if (error !== null) {
55-
console.log('exec error: ' + error);
56-
throw new Error('Failed to fetch resource.');
57-
} else {
58-
const fileBytes = fs.readFileSync(targetPath);
59-
const hasher = crypto.createHash('sha256');
60-
hasher.update(fileBytes);
61-
const sha256Hex = hasher.digest('hex');
62-
if (sha256Hex !== expectedSha256Hex)
63-
throw new Error(
64-
`sha256 does not match the expected sha256. Got ${sha256Hex} but expected ${expectedSha256Hex}`
65-
);
66-
67-
console.log('Download successful. sha256 of file (hex): ', sha256Hex);
68-
if (chmod) {
69-
fs.chmodSync(targetPath, 511);
70-
console.log('Gave executable permission to file.');
71-
}
72-
}
73-
});
74-
}
75-
7648
function downloadHolochainBinary() {
7749
const holochainBinaryRemoteFilename = `holochain-v${kangarooConfig.bins.holochain.version}-${targetEnding}`;
7850
const holochainBinaryUrl = `https://github.com/matthme/holochain-binaries/releases/download/holochain-binaries-${kangarooConfig.bins.holochain.version}/${holochainBinaryRemoteFilename}`;

0 commit comments

Comments
 (0)