diff --git a/README.md b/README.md index 45a8ba6..9a79523 100644 --- a/README.md +++ b/README.md @@ -55,18 +55,22 @@ $ git clone https://github.com/ubsicap/sltt.git sltt 2. Build the `sltt` client source pages ```bash $ cd sltt/client -$ yarn install -$ yarn build:dev:sltt-app:client // or build:prd:sltt-app:client +$ git checkout dev; git pull # OR git checkout main +$ npm install # DON'T use yarn install +$ yarn build:dev:sltt-app:client # or build:prd:sltt-app:client ``` -3. Set the `SLTT_CLIENT_PATH` environment variable to the `sltt/client` directory +3. Set the `SLTT_CLIENT_DIR` environment variable to the `sltt/client` directory ```bash -$ set SLTT_CLIENT_PATH={path to sltt repo sltt/client} # For windows +$ set SLTT_CLIENT_DIR={path to sltt repo sltt/client} # For windows ``` 4. Bump the `package.json` version number +Find the client version number in the build/assets/index-*.js. +It will look like this: const version = "2.63.11"; + The package.json version number is used to create the release tag and version number in the file name, and to check client version code to match our build expectations in step 5 below. For example, if the version number is `206311.4.5`, then it will expect to find a version number matching `2.63.11` in the client source code built from step 4. The `4.51 part is the version number is the sltt-app version number. In semantic versioning terms: `4.5` is `major.minor|patch` where the major part represents something breaking between the client and the electron code, and minor|patch are combined to get bumped for something new or something fixed. Also, the release tag will be `v206311.4.5` and the file name will be `sltt-app Setup 206311.4.5.exe`. For example: @@ -79,10 +83,13 @@ Also, the release tag will be `v206311.4.5` and the file name will be `sltt-app 5. Copy the build `sltt/client/build` to the `sltt-app` `out/client` directory -This step will also verify that the client version number matches the expected version number in step 4 above. +On Windows, this step will also verify that the client version number matches the expected version number in step 4 above. ```bash -$ yarn copy:build:client # uses the `%SLTT_CLIENT_PATH%` environment variable from step 1.3 +# For Windows +$ yarn copy:build:client # uses the `%SLTT_CLIENT_DIR%` environment variable from step 1.3 +# For Mac +$ yarn copy:mac:client # uses the `%SLTT_CLIENT_DIR%` environment variable from step 1.3 ``` 6. Add a commit message that summarizes the release @@ -99,22 +106,30 @@ $ git push Before publishing the new installer, test the new installer to make sure it works as expected. For example: ```bash -# For windows +# For Windows $ npm run build:win:norelease +# For Mac +$ npm run build:mac:norelease ``` The installer will be located in the `dist` directory. For example, `dist/sltt-app Setup 206311.4.5.exe`. -### Publish release to Github +### Publish release to Github (WINDOWS) 1. Set the personal access token (PAT) for the Github account $ set SLTT_APP_PAT={https://github.com/settings/tokens/new?scopes=public_repo&description=sltt-app} +nlm - I was not able to auto generate the PAT as above. +I had to +- go to the link above in my browser +- authenticate to github +- add a line to my .zshrc: export GH_TOKEN="ghp_pixfz5Z..." + 2. Run the `build:win:release script` For example: ```bash -$ yarn build:win:release +$ yarn build:win:release # OR yarn build:mac:release yarn run v1.22.19 warning package.json: No license field $ npm run build && cross-env GH_TOKEN=%SLTT_APP_PAT% electron-builder --win --config --publish always @@ -168,6 +183,32 @@ vite v4.3.3 building for production... Done in 55.90s. ``` -# Building Releases for Mac +### Publish release to Github (Mac) + +Assumes that the corresponding Windows release HAS already been published in GitHub: + +```bash +$ cd sltt/client +$ git checkout dev; git pull # OR git checkout main +$ npm install # DON'T use yarn install +$ yarn build:dev:sltt-app:client # or build:prd:sltt-app:client + +$ cd sltt-app +$ yarn copy:mac:client +$ yarn list:release # find tag for current release + +# verify "version" in package.json is set to current release + +$ yarn show:release # verify version is set to current release +$ yarn build:mac:norelease # build installer but don't upload + +# install dist/sltt-app-${version}.dmg and test + +$ yarn upload:mac:release +$ yarn show:release # verify files uploaded correctly + +# should trigger auto update process for users +``` + -Discussion of process [HERE](https://docs.google.com/document/d/1Qk-bz-uRPBThCXs2rRfNnr4QIxsC3yNlM_e7eMjGGHs/edit?usp=sharing) \ No newline at end of file +Notes on Building Releases for Mac: [HERE](https://docs.google.com/document/d/1Qk-bz-uRPBThCXs2rRfNnr4QIxsC3yNlM_e7eMjGGHs/edit?usp=sharing) \ No newline at end of file diff --git a/dev-app-update.yml b/dev-app-update.yml index 1080c39..5851858 100644 --- a/dev-app-update.yml +++ b/dev-app-update.yml @@ -1,3 +1,3 @@ -provider: generic -url: https://example.com/auto-updates -updaterCacheDirName: sltt-app-updater +provider: github +owner: ericpyle +repo: ubs-icap/sltt-app diff --git a/electron-builder.yml b/electron-builder.yml index faee424..1a2c639 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -42,6 +42,7 @@ linux: appImage: artifactName: ${name}-${version}.${ext} npmRebuild: false +# Publish info here is overwritten by the package.json file publish: provider: generic url: https://example.com/auto-updates diff --git a/package-lock.json b/package-lock.json index ac1f7fc..2d0deb9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sltt-app", - "version": "206507.4.8", + "version": "206512.4.8", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "sltt-app", - "version": "206507.4.8", + "version": "206512.4.8", "hasInstallScript": true, "dependencies": { "@electron-toolkit/preload": "^1.0.3", diff --git a/package.json b/package.json index 7377d51..869953e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sltt-app", - "version": "206507.4.8", + "version": "206512.4.8", "description": "Installable SLTT app (Sign Language Translation Tool)", "main": "./out/main/index.js", "author": "sltt-bible.net", @@ -36,9 +36,15 @@ "build:win:sign:release": "cross-env SIGN=true GH_TOKEN=%GH_TOKEN% npm run build:win:release && npm run build:win:update:metadata && npm run build:win:release:metadata", "build:win:update:metadata": "cross-env LATEST_YAML_PATH=./dist/latest.yml node build/recomputeHash.js && echo 'Do NOT forget to upload updated `dist/latest.yml` to release (e.g. npm run build:win:release:metadata)'", "build:win:release:metadata": "cross-env LATEST_YAML_PATH=./dist/latest.yml node build/updateReleaseMetadata.js", - "build:mac:norelease": "electron-vite build && electron-builder --mac --config --publish never", - "build:mac": "electron-vite build && electron-builder --mac --config", - "build:mac:release": "electron-vite build && electron-builder --mac --config --publish always", + + "list:release": "gh release list -R ubsicap/sltt-app | grep -v 'Draft'", + "show:release": "export versionTag=$(jq -r .version package.json); gh release view v${versionTag} --web -R ubsicap/sltt-app", + + "copy:mac:client": "rm -rf out/client; cp -R $SLTT_CLIENT_DIR/build out/client", + "build:mac:norelease": "yarn copy:mac:client; electron-vite build && electron-builder --mac --config --publish never", + "build:mac:ifNoWinRelease": "yarn copy:mac:client; electron-vite build && electron-builder --mac --config --publish always", + "upload:mac:release": "export versionTag=$(jq -r .version package.json); gh release upload v${versionTag} dist/latest-mac.yml dist/sltt-app-${versionTag}-mac.zip dist/sltt-app-${versionTag}-mac.zip.blockmap dist/sltt-app-${versionTag}.dmg dist/sltt-app-${versionTag}.dmg.blockmap -R ubsicap/sltt-app", + "build:linux": "electron-vite build && electron-builder --linux --config" }, "build": { @@ -49,7 +55,7 @@ "mac": { "target": [ { - "target": "dmg", + "target": "default", "arch": [ "x64" ] diff --git a/src/main/index.ts b/src/main/index.ts index 2c1fe9d..0613378 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -115,7 +115,11 @@ app.whenReady().then(() => { createWindow() - Menu.setApplicationMenu(null) + autoUpdater.forceDevUpdateConfig = true; + + // Uncomment next 2 lines to step thru the autoUpdater logic in the debugger + // autoUpdater.checkForUpdatesAndNotify() + // Menu.setApplicationMenu(null) // Unregister the shortcut when the app is about to quit app.on('will-quit', () => {