Skip to content

Commit

Permalink
Ericbrehault/sc 1795/desktop application ci cd 8 (#271)
Browse files Browse the repository at this point in the history
* fix release name

* Fix auto update
  • Loading branch information
ebrehault authored Sep 21, 2022
1 parent 23dc116 commit ce5fa8e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ jobs:
runs-on: 'ubuntu-latest'
outputs:
release-desktop: ${{ steps.release.outputs.released }}
release-id: ${{ steps.release.outputs.release_id }}
release-tag: ${{ steps.release.outputs.release_tag }}

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -302,23 +302,25 @@ jobs:
uses: softprops/action-gh-release@v1
if: startsWith(matrix.os, 'macos')
with:
tag_name: ${{ needs.pre-release.outputs.release-id }}
tag_name: ${{ needs.pre-release.outputs.release-tag }}
files: |
dist/executables/*.dmg
dist/executables/*.zip
dist/executables/latest-*.yml
- name: Release Windows installer
uses: softprops/action-gh-release@v1
if: startsWith(matrix.os, 'windows')
with:
tag_name: ${{ needs.pre-release.outputs.release-id }}
tag_name: ${{ needs.pre-release.outputs.release-tag }}
files: |
dist/executables/*.exe
dist/executables/app-update.yml
dist/executables/*.yml
- name: Release Linux installer
uses: softprops/action-gh-release@v1
if: startsWith(matrix.os, 'ubuntu')
with:
tag_name: ${{ needs.pre-release.outputs.release-id }}
tag_name: ${{ needs.pre-release.outputs.release-tag }}
files: |
dist/executables/*.snap
dist/executables/*.AppImage
dist/executables/latest-*.yml
1 change: 1 addition & 0 deletions apps/desktop/electron/src/app/api/main.preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ contextBridge.exposeInMainWorld('electron', {
openExternal: (url: string) => shell.openExternal(url),
close: () => ipcRenderer.send('close'),
getMachineId: () => machineIdSync(true),
quitAndReInstall: () => ipcRenderer.send('quitAndReInstall'),
});
9 changes: 9 additions & 0 deletions apps/desktop/electron/src/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,17 @@ export default class App {
App.application.on('window-all-closed', App.onWindowAllClosed); // Quit when all windows are closed.
App.application.on('ready', App.onReady); // App is ready to load data
App.application.on('activate', App.onActivate); // App is activated
autoUpdater.on('update-available', () => {
App.mainWindow?.webContents.executeJavaScript(`alert('A new update is available. Downloading now…')`);
});
autoUpdater.on('update-downloaded', () => {
App.mainWindow?.webContents.executeJavaScript(
`if(confirm('The update is downloaded. Do you want to update now?')){window['electron'].quitAndReInstall()}`,
);
});

ipcMain.on('close', () => app.quit());
ipcMain.on('quitAndReInstall', () => autoUpdater.quitAndInstall());

const gotTheLock = app.requestSingleInstanceLock();
if (gotTheLock) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuclia",
"version": "1.0.12",
"version": "1.0.13",
"license": "MIT",
"author": "Nuclia.cloud",
"description": "Nuclia frontend apps and libs",
Expand Down

0 comments on commit ce5fa8e

Please sign in to comment.