diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..dd28c173 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,38 @@ +name: Deploy to Github Releases + +on: + release: + types: [published] + + + +jobs: + release: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [macos-latest, ubuntu-latest, windows-latest] + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 18.x + + + - name: Build/release Electron app + uses: samuelmeuli/action-electron-builder@v1 + with: + # GitHub token, automatically provided to the action + # (No need to define this secret in the repo settings) + github_token: ${{ secrets.github_token }} + + # If the commit is tagged with a version (e.g. "v1.0.0"), + # release the app after building + release: ${{ startsWith(github.ref, 'refs/tags/v') }} \ No newline at end of file diff --git a/desktop-app/electron-builder.yml b/desktop-app/electron-builder.yml index 87c1822f..bc0caf0e 100644 --- a/desktop-app/electron-builder.yml +++ b/desktop-app/electron-builder.yml @@ -10,4 +10,8 @@ files: - package.json - app +linux: + target: deb + + publish: null diff --git a/desktop-app/main/background.ts b/desktop-app/main/background.ts index 649aba87..a39ab4f0 100644 --- a/desktop-app/main/background.ts +++ b/desktop-app/main/background.ts @@ -1,5 +1,5 @@ import { EnvironmentStatus } from '@aws-sdk/client-elastic-beanstalk' -import { BrowserWindow, app, ipcMain } from 'electron' +import { BrowserWindow, app, autoUpdater, dialog, ipcMain } from 'electron' import serve from 'electron-serve' import { EB_APP_NAME, @@ -25,6 +25,35 @@ if (isProd) { ;(async () => { await app.whenReady() + if (isProd) { + const server = 'https://hazel-c8oqh794d-napse-investment.vercel.app/' + const url = `${server}/update/${process.platform}/${app.getVersion()}` + + autoUpdater.setFeedURL({ url }) + setInterval(() => { + autoUpdater.checkForUpdates() + }, 60000) + autoUpdater.on('update-downloaded', (event, releaseNotes, releaseName) => { + const dialogOpts = { + type: 'info', + buttons: ['Restart', 'Later'], + title: 'Application Update', + message: process.platform === 'win32' ? releaseNotes : releaseName, + detail: + 'A new version has been downloaded. Restart the application to apply the updates.' + } + + dialog.showMessageBox(dialogOpts).then((returnValue) => { + if (returnValue.response === 0) autoUpdater.quitAndInstall() + }) + console.log('update-downloaded') + }) + autoUpdater.on('error', (message) => { + console.error('There was a problem updating the application') + console.error(message) + }) + } + const mainWindow = createWindow('main', { width: 1000, height: 600 diff --git a/desktop-app/main/helpers/aws/deployToAWS.ts b/desktop-app/main/helpers/aws/deployToAWS.ts index 73f0516e..66000647 100644 --- a/desktop-app/main/helpers/aws/deployToAWS.ts +++ b/desktop-app/main/helpers/aws/deployToAWS.ts @@ -40,7 +40,6 @@ export const IAM_INSTANCE_PROFILE_NAME = `napse-iam-instance-profile${ process.env.NODE_ENV === 'production' ? '' : '-dev' }` -console.log('EB_BUCKET_NAME', EB_BUCKET_NAME) export default async function Main( secrets: { AWS__API_TOKEN: string diff --git a/desktop-app/package.json b/desktop-app/package.json index 0f682ef7..e75ddfa8 100644 --- a/desktop-app/package.json +++ b/desktop-app/package.json @@ -3,18 +3,17 @@ "name": "napse", "description": "Napse Desktop App", "homepage": "https://napse-invest.com", - "version": "1.4.0", + "version": "1.5.0", "author": "Napse Invest ", "main": "app/background.js", "scripts": { "start": "nextron", - "build": "nextron build", + "build": "nextron build --mac --linux --win --x64", "build:mac": "nextron build --mac", "build:mac:universal": "nextron build --mac --universal", "build:linux": "nextron build --linux", "build:win32": "nextron build --win --ia32", "build:win64": "nextron build --win --x64", - "build:all": "nextron build --mac --linux --win --x64", "postinstall": "electron-builder install-app-deps", "lint": "next lint" }, @@ -53,15 +52,15 @@ "axios": "^1.5.0", "class-variance-authority": "^0.7.0", "clsx": "^2.0.0", - "electron-dl": "^3.5.1", - "extract-zip": "^2.0.1", - "fs": "^0.0.1-security", - "https": "^1.0.0", "cmdk": "^0.2.1", "date-fns": "^3.3.1", + "electron-dl": "^3.5.1", "electron-serve": "^1.1.0", "electron-store": "^8.1.0", "embla-carousel-react": "^8.0.0-rc20", + "extract-zip": "^2.0.1", + "fs": "^0.0.1-security", + "https": "^1.0.0", "lucide-react": "^0.344.0", "next-themes": "^0.2.1", "react-day-picker": "^8.10.0", @@ -70,8 +69,8 @@ "redaxios": "^0.5.1", "separator": "^0.1.0", "shadcn-ui": "^0.4.1", - "superagent": "^8.1.2", "sonner": "^1.4.3", + "superagent": "^8.1.2", "table": "^6.8.1", "tabs": "^0.2.0", "tailwind-merge": "^1.14.0", @@ -88,7 +87,7 @@ "@typescript-eslint/parser": "^6.16.0", "autoprefixer": "^10.4.7", "electron": "^21.4.4", - "electron-builder": "^24.12.0", + "electron-builder": "^24.13.3", "eslint": "^8.57.0", "eslint-config-next": "13.5.4", "eslint-config-standard-with-typescript": "^39.1.0", diff --git a/desktop-app/renderer/components/custom/selectedObject/inputs.tsx b/desktop-app/renderer/components/custom/selectedObject/inputs.tsx index c10151d1..c01a11bd 100644 --- a/desktop-app/renderer/components/custom/selectedObject/inputs.tsx +++ b/desktop-app/renderer/components/custom/selectedObject/inputs.tsx @@ -112,8 +112,7 @@ export default function CustomForm({ return (
- {/* */} - + {inputs.map((input, index) => { return ( ({ ) : (