From 61876655d90abdae20308e4e219eb6aab47035ae Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 19:27:09 +0200 Subject: [PATCH 01/41] Workflow --- .gitea/workflows/build.yaml | 18 ++++++++++++++++++ package.json | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 .gitea/workflows/build.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..c372922 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,18 @@ +name: Build Windows +on: + push: + branches: + - main + +jobs: + build: + runs-on: windows-latest + steps: + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: '18' + - name: Install npm dependencies + run: npm install + - name: Build the application + run: npm run kernel:win \ No newline at end of file diff --git a/package.json b/package.json index e57a6ff..ec06be4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "Rosetta", - "version": "1.4.8", + "version": "1.4.9", "description": "Rosetta Messenger", "main": "./out/main/main.js", "license": "MIT", -- 2.49.1 From 755bc6ee879a97ce55b5299a1d5dcf9a8b55d54b Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 19:28:26 +0200 Subject: [PATCH 02/41] change windows --- .gitea/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index c372922..4b3cc79 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -6,7 +6,7 @@ on: jobs: build: - runs-on: windows-latest + runs-on: Windows steps: - name: Install Node.js uses: actions/setup-node@v3 -- 2.49.1 From a9e2dbc24ad3ee957519f87ec76d3ba3884de0cb Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 19:32:11 +0200 Subject: [PATCH 03/41] =?UTF-8?q?=D0=A3=D0=B2=D0=B5=D0=BB=D0=B8=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D0=B8?= =?UTF-8?q?=20Node=20=D0=B2=20Workflow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 4b3cc79..83b07a7 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -11,7 +11,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v3 with: - node-version: '18' + node-version: '22' - name: Install npm dependencies run: npm install - name: Build the application -- 2.49.1 From 7ef14364c709b615169fdba6badb56210d686ec4 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 19:40:21 +0200 Subject: [PATCH 04/41] Secrets --- .gitea/workflows/build.yaml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 83b07a7..5bc9545 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,8 +1,9 @@ name: Build Windows + +#Запускаем только кнопкой "Run workflow" в Actions -> Build Windows on: - push: - branches: - - main + workflow_dispatch: + jobs: build: @@ -15,4 +16,13 @@ jobs: - name: Install npm dependencies run: npm install - name: Build the application - run: npm run kernel:win \ No newline at end of file + run: npm run kernel:win + - name: Upload build on SSH + uses: appleboy/scp-action@master + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USERNAME }} + key: ${{ secrets.SSH_KEY }} + port: ${{ secrets.SSH_PORT }} + source: "/dist/builds/win/x64/Rosetta-*.exe" + target: ${{ secrets.SSH_TARGET_DIR }} \ No newline at end of file -- 2.49.1 From 47aa0cbe7dc37b34eace7d08fd94aa0fc6d0e5ad Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 19:50:55 +0200 Subject: [PATCH 05/41] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D0=BE=20SSH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 5bc9545..bb1e0d5 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -22,7 +22,7 @@ jobs: with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USERNAME }} - key: ${{ secrets.SSH_KEY }} port: ${{ secrets.SSH_PORT }} + password: ${{ secrets.SSH_PASSWORD }} source: "/dist/builds/win/x64/Rosetta-*.exe" target: ${{ secrets.SSH_TARGET_DIR }} \ No newline at end of file -- 2.49.1 From caae60e4958942e26b8016899d7fd2e73a106dcc Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 19:54:19 +0200 Subject: [PATCH 06/41] =?UTF-8?q?CI/CD=20=D0=A7=D0=B5=D0=BA=D0=B0=D1=83?= =?UTF-8?q?=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index bb1e0d5..c43027b 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -9,6 +9,8 @@ jobs: build: runs-on: Windows steps: + - name: Checkout code + uses: actions/checkout@v3 - name: Install Node.js uses: actions/setup-node@v3 with: -- 2.49.1 From cdf98d3d8dcbfc1b1457cc99cbea9e970cdaf202 Mon Sep 17 00:00:00 2001 From: Royce59 Date: Tue, 17 Feb 2026 18:04:15 +0000 Subject: [PATCH 07/41] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20app/servers.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/servers.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app/servers.ts diff --git a/app/servers.ts b/app/servers.ts new file mode 100644 index 0000000..aa52cbb --- /dev/null +++ b/app/servers.ts @@ -0,0 +1,11 @@ +export const SERVERS = [ + //'wss://cdn.rosetta-im.com', + //'ws://10.211.55.2:3000', + //'ws://127.0.0.1:3000', + 'wss://wss.rosetta.im' +]; + +export function selectServer(): string { + const idx = Math.floor(Math.random() * SERVERS.length); + return SERVERS[idx]; +} \ No newline at end of file -- 2.49.1 From 9a15383d6536cd07869afd737e3d88cf54910a96 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 20:21:14 +0200 Subject: [PATCH 08/41] CI/CD --- .gitea/workflows/build.yaml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index c43027b..fe5c5b7 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -19,12 +19,13 @@ jobs: run: npm install - name: Build the application run: npm run kernel:win - - name: Upload build on SSH - uses: appleboy/scp-action@master + - name: Upload build to SFTP + uses: wlixcc/SFTP-Deploy-Action@v1.2.4 with: - host: ${{ secrets.SSH_HOST }} + server: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USERNAME }} - port: ${{ secrets.SSH_PORT }} password: ${{ secrets.SSH_PASSWORD }} - source: "/dist/builds/win/x64/Rosetta-*.exe" - target: ${{ secrets.SSH_TARGET_DIR }} \ No newline at end of file + port: ${{ secrets.SSH_PORT }} + local_path: ./dist/builds/win/x64/* + remote_path: ${{ secrets.SSH_TARGET_DIR }} + sftpArgs: '-o ConnectTimeout=5' \ No newline at end of file -- 2.49.1 From b0998990fd996cf11ce538a4fc4f42dcfdc5f192 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 20:29:03 +0200 Subject: [PATCH 09/41] Npm cache --- .gitea/workflows/build.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index fe5c5b7..95bc9a4 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -10,7 +10,14 @@ jobs: runs-on: Windows steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v3 + - name: Cache NPM dependencies + uses: actions/cache@v3 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- - name: Install Node.js uses: actions/setup-node@v3 with: -- 2.49.1 From e39d084dad36598d91d950a6bc4bab00e7974efe Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 20:37:45 +0200 Subject: [PATCH 10/41] Workflow --- .gitea/workflows/build.yaml | 53 ++++++++++++++++++++++++++++++------- 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 95bc9a4..1542027 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -27,12 +27,47 @@ jobs: - name: Build the application run: npm run kernel:win - name: Upload build to SFTP - uses: wlixcc/SFTP-Deploy-Action@v1.2.4 - with: - server: ${{ secrets.SSH_HOST }} - username: ${{ secrets.SSH_USERNAME }} - password: ${{ secrets.SSH_PASSWORD }} - port: ${{ secrets.SSH_PORT }} - local_path: ./dist/builds/win/x64/* - remote_path: ${{ secrets.SSH_TARGET_DIR }} - sftpArgs: '-o ConnectTimeout=5' \ No newline at end of file + shell: pwsh + run: | + # Установка модуля Posh-SSH + Install-Module -Name Posh-SSH -Force -Scope CurrentUser -AllowClobber + + # Получаем файл для загрузки + $file = Get-ChildItem -Path "dist/builds/win/x64/Rosetta-*.exe" | Select-Object -First 1 + + if (-not $file) { + Write-Error "Build file not found in dist/builds/win/x64/" + exit 1 + } + + Write-Host "Found file: $($file.Name)" + + # Создаем credential + $securePassword = ConvertTo-SecureString "${{ secrets.SSH_PASSWORD }}" -AsPlainText -Force + $credential = New-Object System.Management.Automation.PSCredential("${{ secrets.SSH_USERNAME }}", $securePassword) + + # Подключаемся к SFTP + Write-Host "Connecting to SFTP server..." + $session = New-SFTPSession -ComputerName "${{ secrets.SSH_HOST }}" ` + -Credential $credential ` + -Port ${{ secrets.SSH_PORT }} ` + -AcceptKey + + # Удаляем старые файлы в целевой директории + Write-Host "Cleaning remote directory: ${{ secrets.SSH_TARGET_DIR }}" + $remoteFiles = Get-SFTPChildItem -SessionId $session.SessionId -Path "${{ secrets.SSH_TARGET_DIR }}" + foreach ($remoteFile in $remoteFiles) { + Remove-SFTPItem -SessionId $session.SessionId -Path $remoteFile.FullName -Force + Write-Host "Deleted: $($remoteFile.FullName)" + } + + # Загружаем новый файл + Write-Host "Uploading $($file.Name) to ${{ secrets.SSH_TARGET_DIR }}..." + Set-SFTPItem -SessionId $session.SessionId ` + -Path $file.FullName ` + -Destination "${{ secrets.SSH_TARGET_DIR }}/$($file.Name)" + + # Закрываем соединение + Remove-SFTPSession -SessionId $session.SessionId + + Write-Host "Upload completed successfully!" \ No newline at end of file -- 2.49.1 From 8cabb212c16c76e449411159fda854391b76421c Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 20:48:54 +0200 Subject: [PATCH 11/41] pwsh fix --- .gitea/workflows/build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 1542027..d4ffb58 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -27,9 +27,11 @@ jobs: - name: Build the application run: npm run kernel:win - name: Upload build to SFTP - shell: pwsh + shell: powershell run: | # Установка модуля Posh-SSH + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module -Name Posh-SSH -Force -Scope CurrentUser -AllowClobber # Получаем файл для загрузки -- 2.49.1 From 1c873bb118e3bb5235c17cf600328d6859b000ee Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 20:56:21 +0200 Subject: [PATCH 12/41] -Scope CurrentUser --- .gitea/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index d4ffb58..70083c9 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -31,7 +31,7 @@ jobs: run: | # Установка модуля Posh-SSH [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force + Install-PackageProvider -Scope CurrentUser -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module -Name Posh-SSH -Force -Scope CurrentUser -AllowClobber # Получаем файл для загрузки -- 2.49.1 From bbab09a936adc70aeb4b0c84262d3f850cc9761d Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 20:57:20 +0200 Subject: [PATCH 13/41] cache: 'npm' --- .gitea/workflows/build.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 70083c9..68a7543 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -11,17 +11,11 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v3 - - name: Cache NPM dependencies - uses: actions/cache@v3 - with: - path: ~/.npm - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- - name: Install Node.js uses: actions/setup-node@v3 with: node-version: '22' + cache: 'npm' - name: Install npm dependencies run: npm install - name: Build the application -- 2.49.1 From 8f12be2c5d7bb8502e321db79500050756fd2c77 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 21:02:39 +0200 Subject: [PATCH 14/41] npm cache --- .gitea/workflows/build.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 68a7543..ba3317f 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -10,14 +10,13 @@ jobs: runs-on: Windows steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: '22' - cache: 'npm' - name: Install npm dependencies - run: npm install + run: npm ci --cache .npm --prefer-offline - name: Build the application run: npm run kernel:win - name: Upload build to SFTP -- 2.49.1 From 171ed60194d334f7b37b84e3be701d60e7cb3d57 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 21:08:07 +0200 Subject: [PATCH 15/41] ci/cd --- .gitea/workflows/build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index ba3317f..917d08b 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -15,8 +15,9 @@ jobs: uses: actions/setup-node@v4 with: node-version: '22' + cache: 'npm' - name: Install npm dependencies - run: npm ci --cache .npm --prefer-offline + run: npm install - name: Build the application run: npm run kernel:win - name: Upload build to SFTP -- 2.49.1 From d928b48dbd8fb35cef393f4befcd7431b536361c Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 21:10:45 +0200 Subject: [PATCH 16/41] build --- .gitea/workflows/build.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 917d08b..a289d9e 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -11,15 +11,26 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + - name: Install Node.js uses: actions/setup-node@v4 with: node-version: '22' - cache: 'npm' + + - name: Cache node modules + uses: actions/cache@v3 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node- + - name: Install npm dependencies run: npm install + - name: Build the application run: npm run kernel:win + - name: Upload build to SFTP shell: powershell run: | -- 2.49.1 From 95b0f1e0565bb221643b4c958c6789742be255fa Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 21:34:44 +0200 Subject: [PATCH 17/41] act runner test --- .gitea/workflows/build.yaml | 57 +++++++------------------------------ 1 file changed, 10 insertions(+), 47 deletions(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index a289d9e..3e4fb76 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -31,50 +31,13 @@ jobs: - name: Build the application run: npm run kernel:win - - name: Upload build to SFTP - shell: powershell - run: | - # Установка модуля Posh-SSH - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - Install-PackageProvider -Scope CurrentUser -Name NuGet -MinimumVersion 2.8.5.201 -Force - Install-Module -Name Posh-SSH -Force -Scope CurrentUser -AllowClobber - - # Получаем файл для загрузки - $file = Get-ChildItem -Path "dist/builds/win/x64/Rosetta-*.exe" | Select-Object -First 1 - - if (-not $file) { - Write-Error "Build file not found in dist/builds/win/x64/" - exit 1 - } - - Write-Host "Found file: $($file.Name)" - - # Создаем credential - $securePassword = ConvertTo-SecureString "${{ secrets.SSH_PASSWORD }}" -AsPlainText -Force - $credential = New-Object System.Management.Automation.PSCredential("${{ secrets.SSH_USERNAME }}", $securePassword) - - # Подключаемся к SFTP - Write-Host "Connecting to SFTP server..." - $session = New-SFTPSession -ComputerName "${{ secrets.SSH_HOST }}" ` - -Credential $credential ` - -Port ${{ secrets.SSH_PORT }} ` - -AcceptKey - - # Удаляем старые файлы в целевой директории - Write-Host "Cleaning remote directory: ${{ secrets.SSH_TARGET_DIR }}" - $remoteFiles = Get-SFTPChildItem -SessionId $session.SessionId -Path "${{ secrets.SSH_TARGET_DIR }}" - foreach ($remoteFile in $remoteFiles) { - Remove-SFTPItem -SessionId $session.SessionId -Path $remoteFile.FullName -Force - Write-Host "Deleted: $($remoteFile.FullName)" - } - - # Загружаем новый файл - Write-Host "Uploading $($file.Name) to ${{ secrets.SSH_TARGET_DIR }}..." - Set-SFTPItem -SessionId $session.SessionId ` - -Path $file.FullName ` - -Destination "${{ secrets.SSH_TARGET_DIR }}/$($file.Name)" - - # Закрываем соединение - Remove-SFTPSession -SessionId $session.SessionId - - Write-Host "Upload completed successfully!" \ No newline at end of file + - name: Upload to SSH + uses: appleboy/scp-action@master + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USERNAME }} + password: ${{ secrets.SSH_PASSWORD }} + port: ${{ secrets.SSH_PORT }} + source: "dist/builds/win/x64/*.exe" + target: "${{ secrets.SSH_TARGET_DIR }}" + strip_components: 3 \ No newline at end of file -- 2.49.1 From 6bcdaaf0675e4132217e50eabfa779bcde6a17ae Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Tue, 17 Feb 2026 21:51:17 +0200 Subject: [PATCH 18/41] ssh --- .gitea/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 3e4fb76..a04a8ab 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -32,7 +32,7 @@ jobs: run: npm run kernel:win - name: Upload to SSH - uses: appleboy/scp-action@master + uses: appleboy/ssh-action@v1.0.3 # or a Gitea mirror with: host: ${{ secrets.SSH_HOST }} username: ${{ secrets.SSH_USERNAME }} -- 2.49.1 From 3eb2b7f4937156ae3f2aa634c71b2db53ce4ed1b Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 10:30:46 +0200 Subject: [PATCH 19/41] workflow --- .gitea/workflows/sshupload.ps1 | 364 ++++++++++++++++++ .gitea/workflows/{build.yaml => windows.yaml} | 14 +- 2 files changed, 368 insertions(+), 10 deletions(-) create mode 100644 .gitea/workflows/sshupload.ps1 rename .gitea/workflows/{build.yaml => windows.yaml} (65%) diff --git a/.gitea/workflows/sshupload.ps1 b/.gitea/workflows/sshupload.ps1 new file mode 100644 index 0000000..74eb78a --- /dev/null +++ b/.gitea/workflows/sshupload.ps1 @@ -0,0 +1,364 @@ +# PowerShell script to upload files to SFTP server with remote folder cleanup +# Works on clean Windows without additional utilities (uses WinSCP) + +# ========================================== +# PARAMETERS (can override config values via command line) +# ========================================== +param( + [Parameter(Mandatory=$false, HelpMessage="SFTP server IP address or hostname")] + [string]$ServerAddress, + + [Parameter(Mandatory=$false, HelpMessage="Username for connection")] + [string]$Username, + + [Parameter(Mandatory=$false, HelpMessage="Password for connection")] + [string]$PasswordParam, + + [Parameter(Mandatory=$false, HelpMessage="Local file path or pattern (e.g., C:\files\* or dist/builds/x64/Rosetta-*.exe)")] + [string]$LocalFilePath, + + [Parameter(Mandatory=$false, HelpMessage="Remote folder on server")] + [string]$RemoteFolderPath, + + [Parameter(Mandatory=$false, HelpMessage="SSH port")] + [int]$Port, + + [Parameter(Mandatory=$false, HelpMessage="Path to WinSCP executable (auto-detect if not provided)")] + [string]$WinSCPPath +) + +# ========================================== +# CONFIGURATION - Default fallback values +# ========================================== +# These values are used only if not provided via command-line parameters or environment variables +$CONFIG_ServerAddress = "" +$CONFIG_Username = "" +$CONFIG_Password = "" +$CONFIG_LocalFilePath = "" +$CONFIG_RemoteFolderPath = "" +$CONFIG_Port = 22 +$CONFIG_WinSCPPath = "" + +# Priority: Command-line Parameters (highest) > Environment Variables > Config Values (lowest) +# If parameter not provided via command line, check environment variable, then use config value +if (-not $ServerAddress) { + $ServerAddress = if ($env:SFTP_SERVER) { $env:SFTP_SERVER } else { $CONFIG_ServerAddress } +} +if (-not $Username) { + $Username = if ($env:SFTP_USERNAME) { $env:SFTP_USERNAME } else { $CONFIG_Username } +} +if (-not $PasswordParam) { + $PasswordParam = if ($env:SFTP_PASSWORD) { $env:SFTP_PASSWORD } else { $CONFIG_Password } +} +if (-not $LocalFilePath) { + $LocalFilePath = if ($env:SFTP_LOCAL_PATH) { $env:SFTP_LOCAL_PATH } else { $CONFIG_LocalFilePath } +} +if (-not $RemoteFolderPath) { + $RemoteFolderPath = if ($env:SFTP_REMOTE_PATH) { $env:SFTP_REMOTE_PATH } else { $CONFIG_RemoteFolderPath } +} +if (-not $Port -or $Port -eq 0) { + $Port = if ($env:SFTP_PORT) { [int]$env:SFTP_PORT } else { $CONFIG_Port } +} +if (-not $WinSCPPath) { + $WinSCPPath = if ($env:WINSCP_PATH) { $env:WINSCP_PATH } else { $CONFIG_WinSCPPath } +} + +# Validate required parameters +$requiredParams = @( + @{Name = "ServerAddress"; Value = $ServerAddress}, + @{Name = "Username"; Value = $Username}, + @{Name = "Password"; Value = $PasswordParam}, + @{Name = "LocalFilePath"; Value = $LocalFilePath}, + @{Name = "RemoteFolderPath"; Value = $RemoteFolderPath} +) + +$missingParams = @() +foreach ($param in $requiredParams) { + if ([string]::IsNullOrWhiteSpace($param.Value)) { + $missingParams += $param.Name + } +} + +if ($missingParams.Count -gt 0) { + Write-Host "ERROR: Missing required parameters: $($missingParams -join ', ')" -ForegroundColor Red + Write-Host "Please configure values in the script CONFIG section or pass them as parameters." -ForegroundColor Red + exit 1 +} + +# Logging function +function Write-Log { + param( + [Parameter(Mandatory=$false)] + [string]$Message = "(empty message)", + + [Parameter(Mandatory=$false)] + [ValidateSet("Info", "Warning", "Error", "Success")] + [string]$Level = "Info" + ) + + # Handle null or empty messages + if ([string]::IsNullOrWhiteSpace($Message)) { + $Message = "(empty message)" + } + + $timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss" + $color = switch ($Level) { + "Error" { "Red" } + "Warning" { "Yellow" } + "Success" { "Green" } + default { "White" } + } + + Write-Host "[$timestamp] [$Level] $Message" -ForegroundColor $color +} + +# Function to find WinSCP installation +function Find-WinSCP { + $possiblePaths = @( + "C:\Program Files\WinSCP\WinSCP.com", + "C:\Program Files (x86)\WinSCP\WinSCP.com", + "C:\Program Files\WinSCP\WinSCP.exe", + "C:\Program Files (x86)\WinSCP\WinSCP.exe", + "C:\Program Files\WinSCP\WinSCPPortable.exe", + "C:\Program Files (x86)\WinSCP\WinSCPPortable.exe" + ) + + foreach ($path in $possiblePaths) { + if (Test-Path $path) { + Write-Log "Found WinSCP at: $path" "Info" + return $path + } + } + + Write-Log "WinSCP not found. Please install it from https://winscp.net/" "Error" + return $null +} + +# Main upload function using WinSCP +function Upload-ToSFTP { + param( + [Parameter(Mandatory=$true)] + [string]$Server, + + [Parameter(Mandatory=$true)] + [string]$User, + + [Parameter(Mandatory=$true)] + [string]$Pass, + + [Parameter(Mandatory=$true)] + [string[]]$FileList, + + [Parameter(Mandatory=$true)] + [string]$RemotePath, + + [Parameter(Mandatory=$true)] + [int]$PortNum, + + [Parameter(Mandatory=$true)] + [string]$WinSCPExe + ) + + # Password is already a plain string, use it directly + $plainPassword = $Pass + + # Escape special characters in password that could break URL or WinSCP syntax + # Replace @ with %40, : with %3A, # with %23, $ with %24, & with %26 + $escapedPassword = $plainPassword + $escapedPassword = $escapedPassword -replace '@', '%40' + $escapedPassword = $escapedPassword -replace ':', '%3A' + $escapedPassword = $escapedPassword -replace '#', '%23' + $escapedPassword = $escapedPassword -replace '\$', '%24' + $escapedPassword = $escapedPassword -replace '`', '%60' + $escapedPassword = $escapedPassword -replace '&', '%26' + + # Create temporary file paths BEFORE script content (needed for variable expansion) + $timestamp = Get-Date -Format 'yyyyMMdd_HHmmss_fff' + $debugDir = Join-Path $env:TEMP "winscp_debug" + if (-not (Test-Path $debugDir)) { + New-Item -ItemType Directory -Path $debugDir -Force | Out-Null + } + $scriptPath = Join-Path $debugDir "script_$timestamp.txt" + $logFile = Join-Path $debugDir "log_$timestamp.txt" + $outputPath = Join-Path $debugDir "output_$timestamp.txt" + $errorPath = Join-Path $debugDir "error_$timestamp.txt" + + # Create WinSCP script file WITH password (use @"..."@ to expand variables) + $scriptContent = @" +option batch abort +option confirm off +option echo off +option reconnecttime 3 +"@ + + # Add connection string with auto-accept of host key + $scriptContent += "`r`nopen sftp://$User`:$escapedPassword@$Server`:$PortNum -hostkey=`"*`"`r`n" + # Try to clear remote folder by removing all .exe files (ignore if none exist) + $scriptContent += "call rm -f $RemotePath/*.exe`r`n" + + # Add files to WinSCP script + if ($FileList.Count -eq 0) { + Write-Log "No files found matching pattern" "Warning" + $scriptContent += "exit`r`n" + } + else { + foreach ($filePath in $FileList) { + # For local Windows paths, keep backslashes as-is (don't convert to forward slashes) + # WinSCP needs native Windows paths for local files + $remoteFilename = Split-Path $filePath -Leaf + $scriptContent += "put `"$filePath`" `"$RemotePath/$remoteFilename`"`r`n" + } + $scriptContent += "close`r`nexit`r`n" + } + + # Save script to temporary file + try { + Set-Content -Path $scriptPath -Value $scriptContent -Encoding UTF8 + + Write-Log "Created WinSCP script at: $scriptPath" "Info" + Write-Log "Script content:" "Info" + Get-Content $scriptPath | ForEach-Object { Write-Log "$_" "Info" } + + Write-Log "Executing WinSCP: $WinSCPExe" "Info" + + try { + # Determine if this is .com (command-line) or .exe (GUI) + $isCom = $WinSCPExe -like "*.com" + + if ($isCom) { + # WinSCP.com uses /log= for logging + $process = Start-Process -FilePath $WinSCPExe ` + -ArgumentList "/log=$logFile /script=$scriptPath" ` + -NoNewWindow ` + -PassThru ` + -Wait ` + -RedirectStandardOutput $outputPath ` + -RedirectStandardError $errorPath + } + else { + # WinSCP.exe (GUI) - needs option logfile in script + $scriptContent += "`r`noption logfile=$logFile" + Set-Content -Path $scriptPath -Value $scriptContent -Encoding UTF8 + + $process = Start-Process -FilePath $WinSCPExe ` + -ArgumentList "/console /script=$scriptPath" ` + -NoNewWindow ` + -PassThru ` + -Wait ` + -RedirectStandardOutput $outputPath ` + -RedirectStandardError $errorPath + } + } + catch { + Write-Log "Error starting process: $_" "Error" + throw + } + + Write-Log "WinSCP process finished with exit code: $($process.ExitCode)" "Info" + + # Read WinSCP logs + $winscp_log = Get-Content $logFile -ErrorAction SilentlyContinue -Raw + $output = Get-Content $outputPath -ErrorAction SilentlyContinue -Raw + $error_output = Get-Content $errorPath -ErrorAction SilentlyContinue -Raw + + if ($winscp_log) { + Write-Log "WinSCP Log:`r`n$winscp_log" "Info" + } + + if ($output) { + Write-Log "Output:`r`n$output" "Info" + } + else { + Write-Log "No standard output from WinSCP" "Info" + } + + if ($error_output) { + Write-Log "Standard Error:`r`n$error_output" "Error" + } + + if ($process.ExitCode -eq 0) { + Write-Log "Upload completed successfully" "Success" + return $true + } + else { + Write-Log "Upload failed with exit code: $($process.ExitCode)" "Error" + return $false + } + } + catch { + Write-Log "Error during upload: $_" "Error" + return $false + } + finally { + # Cleanup temporary files + Start-Sleep -Milliseconds 500 + if (Test-Path $scriptPath) { + Remove-Item $scriptPath -Force -ErrorAction SilentlyContinue + } + if (Test-Path $logFile) { + Remove-Item $logFile -Force -ErrorAction SilentlyContinue + } + if (Test-Path $outputPath) { + Remove-Item $outputPath -Force -ErrorAction SilentlyContinue + } + if (Test-Path $errorPath) { + Remove-Item $errorPath -Force -ErrorAction SilentlyContinue + } + } +} + +# ================= +# MAIN LOGIC +# ================= + +Write-Log "========== STARTING FILE UPLOAD PROCESS ==========" "Info" +Write-Log "Server: $ServerAddress`:$Port" "Info" +Write-Log "Username: $Username" "Info" +Write-Log "File pattern: $LocalFilePath" "Info" +Write-Log "Remote folder: $RemoteFolderPath" "Info" +Write-Log "=============================================" "Info" + +# Find WinSCP if path not provided +if (-not $WinSCPPath) { + $WinSCPPath = Find-WinSCP + if (-not $WinSCPPath) { + exit 1 + } +} + +# Verify WinSCP exists +if (-not (Test-Path $WinSCPPath)) { + Write-Log "Error: WinSCP not found at: $WinSCPPath" "Error" + exit 1 +} + +# Get files matching pattern +$files = @(Get-Item -Path $LocalFilePath -ErrorAction SilentlyContinue | Where-Object {-not $_.PSIsContainer}) + +if ($files.Count -eq 0) { + Write-Log "Error: No files found matching pattern: $LocalFilePath" "Error" + Write-Log "Current directory: $(Get-Location)" "Error" + Write-Log "Checking if path exists: $(Test-Path $LocalFilePath)" "Error" + exit 1 +} + +Write-Log "Found $($files.Count) file(s) to upload" "Info" +$filePathList = @($files | ForEach-Object {$_.FullName}) + +# Perform upload +$success = Upload-ToSFTP -Server $ServerAddress ` + -User $Username ` + -Pass $PasswordParam ` + -FileList $filePathList ` + -RemotePath $RemoteFolderPath ` + -PortNum $Port ` + -WinSCPExe $WinSCPPath + +Write-Log "========== PROCESS COMPLETED ==========" "Info" + +if ($success) { + exit 0 +} +else { + exit 1 +} diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/windows.yaml similarity index 65% rename from .gitea/workflows/build.yaml rename to .gitea/workflows/windows.yaml index a04a8ab..999ac48 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/windows.yaml @@ -31,13 +31,7 @@ jobs: - name: Build the application run: npm run kernel:win - - name: Upload to SSH - uses: appleboy/ssh-action@v1.0.3 # or a Gitea mirror - with: - host: ${{ secrets.SSH_HOST }} - username: ${{ secrets.SSH_USERNAME }} - password: ${{ secrets.SSH_PASSWORD }} - port: ${{ secrets.SSH_PORT }} - source: "dist/builds/win/x64/*.exe" - target: "${{ secrets.SSH_TARGET_DIR }}" - strip_components: 3 \ No newline at end of file + - name: Upload to SSH using WinSCP Powershell + shell: powershell + run: | + .\sshupload.ps1 -LocalFilePath "dist/builds/win/x64/Rosetta-*.exe" -RemoteFolderPath ${{ secrets.SSH_TARGET_DIR }} -ServerAddress ${{ secrets.SSH_HOST }} -Username ${{ secrets.SSH_USERNAME }} -PasswordParam ${{ secrets.SSH_PASSWORD }} -- 2.49.1 From 319086218d50d4be6d337cae1fd2311c99c41c3a Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 12:20:46 +0200 Subject: [PATCH 20/41] ampersand --- .gitea/workflows/windows.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 999ac48..cb5dcd0 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -34,4 +34,9 @@ jobs: - name: Upload to SSH using WinSCP Powershell shell: powershell run: | - .\sshupload.ps1 -LocalFilePath "dist/builds/win/x64/Rosetta-*.exe" -RemoteFolderPath ${{ secrets.SSH_TARGET_DIR }} -ServerAddress ${{ secrets.SSH_HOST }} -Username ${{ secrets.SSH_USERNAME }} -PasswordParam ${{ secrets.SSH_PASSWORD }} + & ".\sshupload.ps1" ` + -LocalFilePath "dist/builds/win/x64/Rosetta-*.exe" ` + -RemoteFolderPath "${{ secrets.SSH_TARGET_DIR }}" ` + -ServerAddress "${{ secrets.SSH_HOST }}" ` + -Username "${{ secrets.SSH_USERNAME }}" ` + -PasswordParam "${{ secrets.SSH_PASSWORD }}" -- 2.49.1 From eb1cf90d03128a07d653327b4f7d6b47989af11e Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 13:32:44 +0200 Subject: [PATCH 21/41] workspace correct --- .gitea/workflows/windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index cb5dcd0..30f8875 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -34,7 +34,7 @@ jobs: - name: Upload to SSH using WinSCP Powershell shell: powershell run: | - & ".\sshupload.ps1" ` + & "${{ runner.workspace }}\sshupload.ps1" ` -LocalFilePath "dist/builds/win/x64/Rosetta-*.exe" ` -RemoteFolderPath "${{ secrets.SSH_TARGET_DIR }}" ` -ServerAddress "${{ secrets.SSH_HOST }}" ` -- 2.49.1 From d6ce12a00799e9a6575f4a716ef41502c3d1652a Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 13:43:41 +0200 Subject: [PATCH 22/41] npm cache --- .gitea/workflows/windows.yaml | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 30f8875..64a6e15 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -16,17 +16,10 @@ jobs: uses: actions/setup-node@v4 with: node-version: '22' - - - name: Cache node modules - uses: actions/cache@v3 - with: - path: node_modules - key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} - restore-keys: | - ${{ runner.os }}-node- + cache: 'npm' - name: Install npm dependencies - run: npm install + run: npm ci - name: Build the application run: npm run kernel:win -- 2.49.1 From 6a8269afa1b0c6a70f14aac15458abf4cf926ea9 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 13:45:15 +0200 Subject: [PATCH 23/41] github actions --- .gitea/workflows/windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 64a6e15..9def26c 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -27,7 +27,7 @@ jobs: - name: Upload to SSH using WinSCP Powershell shell: powershell run: | - & "${{ runner.workspace }}\sshupload.ps1" ` + & "$env:GITHUB_WORKSPACE\sshupload.ps1" ` -LocalFilePath "dist/builds/win/x64/Rosetta-*.exe" ` -RemoteFolderPath "${{ secrets.SSH_TARGET_DIR }}" ` -ServerAddress "${{ secrets.SSH_HOST }}" ` -- 2.49.1 From 779fa202b862531570bc924e38623dba3d9ae0d2 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 13:54:01 +0200 Subject: [PATCH 24/41] npm cache --- .gitea/workflows/windows.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 9def26c..54bb9ba 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -10,13 +10,14 @@ jobs: runs-on: Windows steps: - name: Checkout code - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Install Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: '22' + node-version: '24' cache: 'npm' + cache-dependency-path: '**/package-lock.json' - name: Install npm dependencies run: npm ci -- 2.49.1 From fc73cf2acfad25a7b2847aaab78eb138fdb812f7 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 13:58:06 +0200 Subject: [PATCH 25/41] cache --- .gitea/workflows/windows.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 54bb9ba..ad1ccd6 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -17,10 +17,9 @@ jobs: with: node-version: '24' cache: 'npm' - cache-dependency-path: '**/package-lock.json' - name: Install npm dependencies - run: npm ci + run: npm ci --legacy-peer-deps - name: Build the application run: npm run kernel:win -- 2.49.1 From 05429a072650e4646b56a13ce431f90c5ec2777b Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 14:10:40 +0200 Subject: [PATCH 26/41] test --- .gitea/workflows/windows.yaml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index ad1ccd6..0aaa764 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -16,10 +16,25 @@ jobs: uses: actions/setup-node@v6 with: node-version: '24' - cache: 'npm' + + # Кэш для node_modules + - name: Cache node_modules + uses: actions/cache@v6 + with: + path: node_modules + key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + + # Кэш для electron-builder + - name: Cache electron-builder + uses: actions/cache@v6 + with: + path: | + ${{ env.LOCALAPPDATA }}\\electron-builder\\Cache + ${{ env.LOCALAPPDATA }}\\electron\\Cache + key: ${{ runner.os }}-electron-builder - name: Install npm dependencies - run: npm ci --legacy-peer-deps + run: npm ci - name: Build the application run: npm run kernel:win -- 2.49.1 From 5470df481d89ed6cc07d8bf9cbe4ad9476c13431 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 14:12:49 +0200 Subject: [PATCH 27/41] test --- .gitea/workflows/windows.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 0aaa764..41a5914 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -19,14 +19,14 @@ jobs: # Кэш для node_modules - name: Cache node_modules - uses: actions/cache@v6 + uses: actions/cache@v5 with: path: node_modules key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} # Кэш для electron-builder - name: Cache electron-builder - uses: actions/cache@v6 + uses: actions/cache@v5 with: path: | ${{ env.LOCALAPPDATA }}\\electron-builder\\Cache -- 2.49.1 From 65089fd71bcf3ef6f06dd9cbcf16e61c0a716bb6 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 14:29:09 +0200 Subject: [PATCH 28/41] / --- .gitea/workflows/windows.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 41a5914..0af8108 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -22,7 +22,10 @@ jobs: uses: actions/cache@v5 with: path: node_modules - key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} + key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-node- + if-no-files-found: ignore # Кэш для electron-builder - name: Cache electron-builder @@ -31,10 +34,13 @@ jobs: path: | ${{ env.LOCALAPPDATA }}\\electron-builder\\Cache ${{ env.LOCALAPPDATA }}\\electron\\Cache - key: ${{ runner.os }}-electron-builder + key: ${{ runner.os }}-electron-builder-${{ hashFiles('**/electron-builder.yml') }} + restore-keys: | + ${{ runner.os }}-electron-builder- + if-no-files-found: ignore - name: Install npm dependencies - run: npm ci + run: npm install - name: Build the application run: npm run kernel:win @@ -42,7 +48,7 @@ jobs: - name: Upload to SSH using WinSCP Powershell shell: powershell run: | - & "$env:GITHUB_WORKSPACE\sshupload.ps1" ` + & "$env:GITHUB_WORKSPACE\.gitea\sshupload.ps1" ` -LocalFilePath "dist/builds/win/x64/Rosetta-*.exe" ` -RemoteFolderPath "${{ secrets.SSH_TARGET_DIR }}" ` -ServerAddress "${{ secrets.SSH_HOST }}" ` -- 2.49.1 From 3a854c8d27d030f96089b6d6d100fc1f8fae8788 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 14:41:58 +0200 Subject: [PATCH 29/41] / --- .gitea/workflows/windows.yaml | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 0af8108..6c4a883 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -17,16 +17,6 @@ jobs: with: node-version: '24' - # Кэш для node_modules - - name: Cache node_modules - uses: actions/cache@v5 - with: - path: node_modules - key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }} - restore-keys: | - ${{ runner.os }}-node- - if-no-files-found: ignore - # Кэш для electron-builder - name: Cache electron-builder uses: actions/cache@v5 @@ -39,8 +29,14 @@ jobs: ${{ runner.os }}-electron-builder- if-no-files-found: ignore + - name: NPM offline setup + shell: powershell + run: | + npm config set cache "$env:LOCALAPPDATA\npm-cache" --global + npm config set prefer-offline true --global + - name: Install npm dependencies - run: npm install + run: npm install --prefer-offline --no-audit --no-fund - name: Build the application run: npm run kernel:win -- 2.49.1 From f6a57762c088772635c3fe3e5ce028cfa2ac9226 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 14:47:07 +0200 Subject: [PATCH 30/41] / --- .gitea/workflows/windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 6c4a883..242d3f3 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -15,7 +15,7 @@ jobs: - name: Install Node.js uses: actions/setup-node@v6 with: - node-version: '24' + node-version: '22' # Кэш для electron-builder - name: Cache electron-builder -- 2.49.1 From c24c1c7fd95f0a8ca634821c6f54afa61e3f2a45 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 14:58:43 +0200 Subject: [PATCH 31/41] / --- .gitea/workflows/windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 242d3f3..b775044 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -44,7 +44,7 @@ jobs: - name: Upload to SSH using WinSCP Powershell shell: powershell run: | - & "$env:GITHUB_WORKSPACE\.gitea\sshupload.ps1" ` + & "$env:GITHUB_WORKSPACE\.gitea\workflow\sshupload.ps1" ` -LocalFilePath "dist/builds/win/x64/Rosetta-*.exe" ` -RemoteFolderPath "${{ secrets.SSH_TARGET_DIR }}" ` -ServerAddress "${{ secrets.SSH_HOST }}" ` -- 2.49.1 From 6a69c3b1950c06cb14603da0f893abd5861cde96 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 15:05:26 +0200 Subject: [PATCH 32/41] / --- .gitea/workflows/windows.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index b775044..55d13dd 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -44,7 +44,7 @@ jobs: - name: Upload to SSH using WinSCP Powershell shell: powershell run: | - & "$env:GITHUB_WORKSPACE\.gitea\workflow\sshupload.ps1" ` + & "$env:GITHUB_WORKSPACE\.gitea\workflows\sshupload.ps1" ` -LocalFilePath "dist/builds/win/x64/Rosetta-*.exe" ` -RemoteFolderPath "${{ secrets.SSH_TARGET_DIR }}" ` -ServerAddress "${{ secrets.SSH_HOST }}" ` -- 2.49.1 From 597e2e0532cf2ac4dadffd986ce7adbea71df2ab Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 15:26:33 +0200 Subject: [PATCH 33/41] / --- .gitea/workflows/sshupload.ps1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/sshupload.ps1 b/.gitea/workflows/sshupload.ps1 index 74eb78a..c5dd457 100644 --- a/.gitea/workflows/sshupload.ps1 +++ b/.gitea/workflows/sshupload.ps1 @@ -47,7 +47,8 @@ if (-not $ServerAddress) { if (-not $Username) { $Username = if ($env:SFTP_USERNAME) { $env:SFTP_USERNAME } else { $CONFIG_Username } } -if (-not $PasswordParam) { +# Если пароль передан через CLI (-PasswordParam), используем его даже если пустая строка +if (-not $PSBoundParameters.ContainsKey('PasswordParam')) { $PasswordParam = if ($env:SFTP_PASSWORD) { $env:SFTP_PASSWORD } else { $CONFIG_Password } } if (-not $LocalFilePath) { @@ -67,7 +68,7 @@ if (-not $WinSCPPath) { $requiredParams = @( @{Name = "ServerAddress"; Value = $ServerAddress}, @{Name = "Username"; Value = $Username}, - @{Name = "Password"; Value = $PasswordParam}, + @{Name = "PasswordParam"; Value = $PasswordParam}, @{Name = "LocalFilePath"; Value = $LocalFilePath}, @{Name = "RemoteFolderPath"; Value = $RemoteFolderPath} ) -- 2.49.1 From 0ac5ecee8a2c4b90d9bb51372492c9a13ebd6c55 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 15:38:44 +0200 Subject: [PATCH 34/41] / --- .gitea/workflows/sshupload.ps1 | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/sshupload.ps1 b/.gitea/workflows/sshupload.ps1 index c5dd457..c7c3746 100644 --- a/.gitea/workflows/sshupload.ps1 +++ b/.gitea/workflows/sshupload.ps1 @@ -160,14 +160,15 @@ function Upload-ToSFTP { [string]$WinSCPExe ) - # Password is already a plain string, use it directly - $plainPassword = $Pass - + # If password came URL-encoded (e.g., %23 for #), decode once + if ($Pass -match '%[0-9A-Fa-f]{2}') { + $Pass = [System.Net.WebUtility]::UrlDecode($Pass) + } + # Escape special characters in password that could break URL or WinSCP syntax - # Replace @ with %40, : with %3A, # with %23, $ with %24, & with %26 - $escapedPassword = $plainPassword + $escapedPassword = $Pass $escapedPassword = $escapedPassword -replace '@', '%40' - $escapedPassword = $escapedPassword -replace ':', '%3A' + $escapedPassword = $escapedPassword -replace ':', '%3A' $escapedPassword = $escapedPassword -replace '#', '%23' $escapedPassword = $escapedPassword -replace '\$', '%24' $escapedPassword = $escapedPassword -replace '`', '%60' -- 2.49.1 From 7472747a9e43083eb49f255fca2da809fba662af Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 16:21:26 +0200 Subject: [PATCH 35/41] / --- .gitea/workflows/sshupload.ps1 | 19 ++++--------------- .gitea/workflows/windows.yaml | 2 +- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/sshupload.ps1 b/.gitea/workflows/sshupload.ps1 index c7c3746..11281a3 100644 --- a/.gitea/workflows/sshupload.ps1 +++ b/.gitea/workflows/sshupload.ps1 @@ -160,19 +160,8 @@ function Upload-ToSFTP { [string]$WinSCPExe ) - # If password came URL-encoded (e.g., %23 for #), decode once - if ($Pass -match '%[0-9A-Fa-f]{2}') { - $Pass = [System.Net.WebUtility]::UrlDecode($Pass) - } - - # Escape special characters in password that could break URL or WinSCP syntax - $escapedPassword = $Pass - $escapedPassword = $escapedPassword -replace '@', '%40' - $escapedPassword = $escapedPassword -replace ':', '%3A' - $escapedPassword = $escapedPassword -replace '#', '%23' - $escapedPassword = $escapedPassword -replace '\$', '%24' - $escapedPassword = $escapedPassword -replace '`', '%60' - $escapedPassword = $escapedPassword -replace '&', '%26' + # Decode once if URL-encoded; we will pass plain password via -password switch (no extra encoding needed) + $decodedPassword = if ($Pass -match '%[0-9A-Fa-f]{2}') { [System.Net.WebUtility]::UrlDecode($Pass) } else { $Pass } # Create temporary file paths BEFORE script content (needed for variable expansion) $timestamp = Get-Date -Format 'yyyyMMdd_HHmmss_fff' @@ -193,8 +182,8 @@ option echo off option reconnecttime 3 "@ - # Add connection string with auto-accept of host key - $scriptContent += "`r`nopen sftp://$User`:$escapedPassword@$Server`:$PortNum -hostkey=`"*`"`r`n" + # Add connection string with auto-accept of host key; pass password via -password to avoid URL encoding issues + $scriptContent += "`r`nopen sftp://$User@$Server`:$PortNum/ -password=`"$decodedPassword`" -hostkey=`"*`"`r`n" # Try to clear remote folder by removing all .exe files (ignore if none exist) $scriptContent += "call rm -f $RemotePath/*.exe`r`n" diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 55d13dd..7b13520 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -49,4 +49,4 @@ jobs: -RemoteFolderPath "${{ secrets.SSH_TARGET_DIR }}" ` -ServerAddress "${{ secrets.SSH_HOST }}" ` -Username "${{ secrets.SSH_USERNAME }}" ` - -PasswordParam "${{ secrets.SSH_PASSWORD }}" + -PasswordParam '${{ secrets.SSH_PASSWORD }}' -- 2.49.1 From 3735f680d2489e3af8e42f8438e80240138e1b8a Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 16:55:21 +0200 Subject: [PATCH 36/41] darwin workflow --- .gitea/workflows/darwin.yaml | 44 +++++++++++++++++++++++++++++++++++ .gitea/workflows/windows.yaml | 11 +++++++-- 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/darwin.yaml diff --git a/.gitea/workflows/darwin.yaml b/.gitea/workflows/darwin.yaml new file mode 100644 index 0000000..b1b052e --- /dev/null +++ b/.gitea/workflows/darwin.yaml @@ -0,0 +1,44 @@ +name: MacOS Kernel Build + +#Запускаем только кнопкой "Run workflow" в Actions -> Build MacOS +on: + workflow_dispatch: + +jobs: + build: + runs-on: macos + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install Node.js + uses: actions/setup-node@v6 + with: + node-version: '22' + # Кэш для electron-builder + - name: Cache electron-builder + uses: actions/cache@v5 + with: + path: | + ${{ env.HOME }}/Library/Caches/electron-builder + ${{ env.HOME }}/Library/Caches/electron + key: ${{ runner.os }}-electron-builder-${{ hashFiles('**/electron-builder.yml') }} + restore-keys: | + ${{ runner.os }}-electron-builder- + if-no-files-found: ignore + - name: NPM offline setup + shell: bash + run: | + npm config set cache "$HOME/.npm-cache" --global + npm config set prefer-offline true --global + - name: Install npm dependencies + run: npm install --prefer-offline --no-audit --no-fund + - name: Build the application + run: npm run kernel:mac + #Загружаем на удаленный сервер по SSH используя scp и пароль из секретов + #Загружаем из двух папок dist/builds/darwin/x64 и dist/builds/darwin/arm64, так как electron-builder может создавать разные файлы для разных архитектур + - name: Upload to SSH using scp + shell: bash + run: | + scp -o StrictHostKeyChecking=no dist/builds/darwin/arm64/Rosetta-*.pkg "${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_TARGET_DIR }}/darwin/arm64" <<< "${{ secrets.SSH_PASSWORD }}" + scp -o StrictHostKeyChecking=no dist/builds/darwin/x64/Rosetta-*.pkg "${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_TARGET_DIR }}/darwin/x64" <<< "${{ secrets.SSH_PASSWORD }}" \ No newline at end of file diff --git a/.gitea/workflows/windows.yaml b/.gitea/workflows/windows.yaml index 7b13520..89c6f7a 100644 --- a/.gitea/workflows/windows.yaml +++ b/.gitea/workflows/windows.yaml @@ -1,8 +1,15 @@ -name: Build Windows +name: Windows Kernel Build #Запускаем только кнопкой "Run workflow" в Actions -> Build Windows +#Или если есть коммпит в папку lib в ветке main on: workflow_dispatch: + push: + branches: + - main + paths: + - 'lib/**' + jobs: @@ -46,7 +53,7 @@ jobs: run: | & "$env:GITHUB_WORKSPACE\.gitea\workflows\sshupload.ps1" ` -LocalFilePath "dist/builds/win/x64/Rosetta-*.exe" ` - -RemoteFolderPath "${{ secrets.SSH_TARGET_DIR }}" ` + -RemoteFolderPath "${{ secrets.SSH_TARGET_DIR }}/win32/x64" ` -ServerAddress "${{ secrets.SSH_HOST }}" ` -Username "${{ secrets.SSH_USERNAME }}" ` -PasswordParam '${{ secrets.SSH_PASSWORD }}' -- 2.49.1 From 9410b0f1e675a40e054f2334bf19e487b4b906be Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 17:47:26 +0200 Subject: [PATCH 37/41] Workflow --- .gitea/workflows/darwin.yaml | 31 ++++++++++- .gitea/workflows/linux.yaml | 71 +++++++++++++++++++++++++ .gitea/workflows/service-packs.yaml | 82 +++++++++++++++++++++++++++++ .gitea/workflows/sshupload.sh | 67 +++++++++++++++++++++++ 4 files changed, 249 insertions(+), 2 deletions(-) create mode 100644 .gitea/workflows/linux.yaml create mode 100644 .gitea/workflows/service-packs.yaml create mode 100644 .gitea/workflows/sshupload.sh diff --git a/.gitea/workflows/darwin.yaml b/.gitea/workflows/darwin.yaml index b1b052e..4440365 100644 --- a/.gitea/workflows/darwin.yaml +++ b/.gitea/workflows/darwin.yaml @@ -3,6 +3,11 @@ name: MacOS Kernel Build #Запускаем только кнопкой "Run workflow" в Actions -> Build MacOS on: workflow_dispatch: + push: + branches: + - main + paths: + - 'lib/**' jobs: build: @@ -15,6 +20,16 @@ jobs: uses: actions/setup-node@v6 with: node-version: '22' + + # Кэш npm (тарифы грузятся из ~/.npm-cache на macOS) + - name: Cache npm cache + uses: actions/cache@v5 + with: + path: ${{ env.HOME }}/.npm-cache + key: ${{ runner.os }}-npm-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-npm- + if-no-files-found: ignore # Кэш для electron-builder - name: Cache electron-builder uses: actions/cache@v5 @@ -37,8 +52,20 @@ jobs: run: npm run kernel:mac #Загружаем на удаленный сервер по SSH используя scp и пароль из секретов #Загружаем из двух папок dist/builds/darwin/x64 и dist/builds/darwin/arm64, так как electron-builder может создавать разные файлы для разных архитектур + #Вызываем файл sshupload.sh и передаем ему параметры из секретов, чтобы не хранить пароль в открытом виде в workflow - name: Upload to SSH using scp shell: bash run: | - scp -o StrictHostKeyChecking=no dist/builds/darwin/arm64/Rosetta-*.pkg "${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_TARGET_DIR }}/darwin/arm64" <<< "${{ secrets.SSH_PASSWORD }}" - scp -o StrictHostKeyChecking=no dist/builds/darwin/x64/Rosetta-*.pkg "${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:${{ secrets.SSH_TARGET_DIR }}/darwin/x64" <<< "${{ secrets.SSH_PASSWORD }}" \ No newline at end of file + "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ + -l "$GITHUB_WORKSPACE/dist/builds/darwin/x64/Rosetta-*.dmg" \ + -r "${{ secrets.SSH_TARGET_DIR }}/darwin/x64" \ + -s "${{ secrets.SSH_HOST }}" \ + -u "${{ secrets.SSH_USERNAME }}" \ + -p '${{ secrets.SSH_PASSWORD }}' + "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ + -l "$GITHUB_WORKSPACE/dist/builds/darwin/arm64/Rosetta-*.dmg" \ + -r "${{ secrets.SSH_TARGET_DIR }}/darwin/arm64" \ + -s "${{ secrets.SSH_HOST }}" \ + -u "${{ secrets.SSH_USERNAME }}" \ + -p '${{ secrets.SSH_PASSWORD }}' + \ No newline at end of file diff --git a/.gitea/workflows/linux.yaml b/.gitea/workflows/linux.yaml new file mode 100644 index 0000000..f77bbd5 --- /dev/null +++ b/.gitea/workflows/linux.yaml @@ -0,0 +1,71 @@ +name: Linux Kernel Build + +#Запускаем только кнопкой "Run workflow" в Actions +on: + workflow_dispatch: + push: + branches: + - main + paths: + - 'lib/**' + +jobs: + build: + runs-on: macos + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install Node.js + uses: actions/setup-node@v6 + with: + node-version: '22' + + # Кэш npm (тарифы грузятся из ~/.npm-cache на macOS) + - name: Cache npm cache + uses: actions/cache@v5 + with: + path: ${{ env.HOME }}/.npm-cache + key: ${{ runner.os }}-npm-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-npm- + if-no-files-found: ignore + # Кэш для electron-builder + - name: Cache electron-builder + uses: actions/cache@v5 + with: + path: | + ${{ env.HOME }}/Library/Caches/electron-builder + ${{ env.HOME }}/Library/Caches/electron + key: ${{ runner.os }}-electron-builder-${{ hashFiles('**/electron-builder.yml') }} + restore-keys: | + ${{ runner.os }}-electron-builder- + if-no-files-found: ignore + - name: NPM offline setup + shell: bash + run: | + npm config set cache "$HOME/.npm-cache" --global + npm config set prefer-offline true --global + - name: Install npm dependencies + run: npm install --prefer-offline --no-audit --no-fund + - name: Build the application + run: npm run kernel:linux + #Загружаем на удаленный сервер по SSH используя scp и пароль из секретов + #Загружаем из двух папок dist/builds/darwin/x64 и dist/builds/darwin/arm64, так как electron-builder может создавать разные файлы для разных архитектур + #Вызываем файл sshupload.sh и передаем ему параметры из секретов, чтобы не хранить пароль в открытом виде в workflow + - name: Upload to SSH + shell: bash + run: | + "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ + -l "$GITHUB_WORKSPACE/dist/builds/linux/x64/Rosetta-*.AppImage" \ + -r "${{ secrets.SSH_TARGET_DIR }}/linux/x64" \ + -s "${{ secrets.SSH_HOST }}" \ + -u "${{ secrets.SSH_USERNAME }}" \ + -p '${{ secrets.SSH_PASSWORD }}' + "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ + -l "$GITHUB_WORKSPACE/dist/builds/linux/arm64/Rosetta-*.AppImage" \ + -r "${{ secrets.SSH_TARGET_DIR }}/linux/arm64" \ + -s "${{ secrets.SSH_HOST }}" \ + -u "${{ secrets.SSH_USERNAME }}" \ + -p '${{ secrets.SSH_PASSWORD }}' + \ No newline at end of file diff --git a/.gitea/workflows/service-packs.yaml b/.gitea/workflows/service-packs.yaml new file mode 100644 index 0000000..6408f53 --- /dev/null +++ b/.gitea/workflows/service-packs.yaml @@ -0,0 +1,82 @@ +name: SP Builds + +#Запускаем только кнопкой "Run workflow" в Actions -> Build MacOS +on: + workflow_dispatch: + push: + branches: + - main + paths: + - 'lib/**' + +jobs: + build: + strategy: + matrix: + os: [macos, ubuntu] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install Node.js + uses: actions/setup-node@v6 + with: + node-version: '22' + # Кэш npm (тарифы грузятся из ~/.npm-cache на macOS) + - name: Cache npm cache + uses: actions/cache@v5 + with: + path: ${{ env.HOME }}/.npm-cache + key: ${{ runner.os }}-npm-${{ hashFiles('**/package.json') }} + restore-keys: | + ${{ runner.os }}-npm- + if-no-files-found: ignore + # Кэш для electron-builder (macOS) + - name: Cache electron-builder (macOS) + if: matrix.os == 'macos' + uses: actions/cache@v5 + with: + path: | + ${{ env.HOME }}/Library/Caches/electron-builder + ${{ env.HOME }}/Library/Caches/electron + key: ${{ runner.os }}-electron-builder-${{ hashFiles('**/electron-builder.yml') }} + restore-keys: | + ${{ runner.os }}-electron-builder- + if-no-files-found: ignore + + # Кэш для electron-builder (Ubuntu) + - name: Cache electron-builder (Ubuntu) + if: matrix.os == 'ubuntu' + uses: actions/cache@v5 + with: + path: | + ${{ env.HOME }}/.cache/electron-builder + ${{ env.HOME }}/.cache/electron + key: ${{ runner.os }}-electron-builder-${{ hashFiles('**/electron-builder.yml') }} + restore-keys: | + ${{ runner.os }}-electron-builder- + if-no-files-found: ignore + + - name: NPM offline setup + shell: bash + run: | + npm config set cache "$HOME/.npm-cache" --global + npm config set prefer-offline true --global + + - name: Install npm dependencies + run: npm install --prefer-offline --no-audit --no-fund + + - name: Build the application + run: npm run kernel:linux + #Загружаем на удаленный сервер по SSH используя scp и пароль из секретов + #Загружаем из двух папок dist/builds/darwin/x64 и dist/builds/darwin/arm64, так как electron-builder может создавать разные файлы для разных архитектур + - name: Upload to SSH + shell: bash + run: | + "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ + -l "$GITHUB_WORKSPACE/packs/*" \ + -r "${{ secrets.SDU_SSH_PACKS }}" \ + -s "${{ secrets.SSH_HOST }}" \ + -u "${{ secrets.SSH_USERNAME }}" \ + -p '${{ secrets.SSH_PASSWORD }}' \ No newline at end of file diff --git a/.gitea/workflows/sshupload.sh b/.gitea/workflows/sshupload.sh new file mode 100644 index 0000000..9ecf450 --- /dev/null +++ b/.gitea/workflows/sshupload.sh @@ -0,0 +1,67 @@ +#!/usr/bin/env bash +set -euo pipefail + +usage() { + cat <<'EOF' +Usage: sshupload.sh -l -r -s -u -p +EOF +} + +local_glob="" +remote_dir="" +server="" +user="" +password="" + +while [[ $# -gt 0 ]]; do + case "$1" in + -l|--local) local_glob="$2"; shift 2;; + -r|--remote) remote_dir="$2"; shift 2;; + -s|--server) server="$2"; shift 2;; + -u|--user) user="$2"; shift 2;; + -p|--password) password="$2"; shift 2;; + -h|--help) usage; exit 0;; + *) echo "Unknown arg: $1" >&2; usage; exit 1;; + esac +done + +if [[ -z "$local_glob" || -z "$remote_dir" || -z "$server" || -z "$user" || -z "$password" ]]; then + echo "Missing required params" >&2 + usage + exit 1 +fi + +# Ensure sshpass installed +if ! command -v sshpass >/dev/null 2>&1; then + if command -v brew >/dev/null 2>&1; then + brew update + brew install hudochenkov/sshpass/sshpass + elif command -v apt-get >/dev/null 2>&1; then + sudo apt-get update + sudo apt-get install -y sshpass + else + echo "sshpass not found and no supported package manager" >&2 + exit 1 + fi +fi + +user_host="${user}@${server}" + +# Ensure remote dir exists and clear it +sshpass -p "$password" ssh -o StrictHostKeyChecking=no "$user_host" "mkdir -p '$remote_dir' && rm -f '$remote_dir'/*" + +# Expand glob (supports ~ and patterns) and upload each file (compatible with macOS bash 3.x) +shopt -s nullglob +eval "files=( ${local_glob} )" +shopt -u nullglob + +if [[ ${#files[@]} -eq 0 ]]; then + echo "No files matched: $local_glob" >&2 + exit 1 +fi + +for f in "${files[@]}"; do + sshpass -p "$password" scp -o StrictHostKeyChecking=no "$f" "$user_host:$remote_dir/" +done + +echo "Upload completed" -- 2.49.1 From 3f239ed82bad5105bf50bbef7ac7b59238809a2c Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 17:53:37 +0200 Subject: [PATCH 38/41] Workflow --- .gitea/workflows/darwin.yaml | 5 +++-- .gitea/workflows/linux.yaml | 5 +++-- .gitea/workflows/service-packs.yaml | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitea/workflows/darwin.yaml b/.gitea/workflows/darwin.yaml index 4440365..3801103 100644 --- a/.gitea/workflows/darwin.yaml +++ b/.gitea/workflows/darwin.yaml @@ -56,13 +56,14 @@ jobs: - name: Upload to SSH using scp shell: bash run: | - "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ + chmod +x "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" + sh "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ -l "$GITHUB_WORKSPACE/dist/builds/darwin/x64/Rosetta-*.dmg" \ -r "${{ secrets.SSH_TARGET_DIR }}/darwin/x64" \ -s "${{ secrets.SSH_HOST }}" \ -u "${{ secrets.SSH_USERNAME }}" \ -p '${{ secrets.SSH_PASSWORD }}' - "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ + sh "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ -l "$GITHUB_WORKSPACE/dist/builds/darwin/arm64/Rosetta-*.dmg" \ -r "${{ secrets.SSH_TARGET_DIR }}/darwin/arm64" \ -s "${{ secrets.SSH_HOST }}" \ diff --git a/.gitea/workflows/linux.yaml b/.gitea/workflows/linux.yaml index f77bbd5..ed1951a 100644 --- a/.gitea/workflows/linux.yaml +++ b/.gitea/workflows/linux.yaml @@ -56,13 +56,14 @@ jobs: - name: Upload to SSH shell: bash run: | - "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ + chmod +x "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" + sh "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ -l "$GITHUB_WORKSPACE/dist/builds/linux/x64/Rosetta-*.AppImage" \ -r "${{ secrets.SSH_TARGET_DIR }}/linux/x64" \ -s "${{ secrets.SSH_HOST }}" \ -u "${{ secrets.SSH_USERNAME }}" \ -p '${{ secrets.SSH_PASSWORD }}' - "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ + sh "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ -l "$GITHUB_WORKSPACE/dist/builds/linux/arm64/Rosetta-*.AppImage" \ -r "${{ secrets.SSH_TARGET_DIR }}/linux/arm64" \ -s "${{ secrets.SSH_HOST }}" \ diff --git a/.gitea/workflows/service-packs.yaml b/.gitea/workflows/service-packs.yaml index 6408f53..e8b51e1 100644 --- a/.gitea/workflows/service-packs.yaml +++ b/.gitea/workflows/service-packs.yaml @@ -74,7 +74,8 @@ jobs: - name: Upload to SSH shell: bash run: | - "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ + chmod +x "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" + sh "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ -l "$GITHUB_WORKSPACE/packs/*" \ -r "${{ secrets.SDU_SSH_PACKS }}" \ -s "${{ secrets.SSH_HOST }}" \ -- 2.49.1 From d55073b7bc757f066ee81aefc24a0dadfd503436 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 18:04:25 +0200 Subject: [PATCH 39/41] Workflow --- .gitea/workflows/service-packs.yaml | 27 +++++++++------------------ build-packs.sh | 3 +-- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/.gitea/workflows/service-packs.yaml b/.gitea/workflows/service-packs.yaml index e8b51e1..008d538 100644 --- a/.gitea/workflows/service-packs.yaml +++ b/.gitea/workflows/service-packs.yaml @@ -11,10 +11,7 @@ on: jobs: build: - strategy: - matrix: - os: [macos, ubuntu] - runs-on: ${{ matrix.os }} + runs-on: macos steps: - name: Checkout code uses: actions/checkout@v6 @@ -34,7 +31,6 @@ jobs: if-no-files-found: ignore # Кэш для electron-builder (macOS) - name: Cache electron-builder (macOS) - if: matrix.os == 'macos' uses: actions/cache@v5 with: path: | @@ -45,19 +41,6 @@ jobs: ${{ runner.os }}-electron-builder- if-no-files-found: ignore - # Кэш для electron-builder (Ubuntu) - - name: Cache electron-builder (Ubuntu) - if: matrix.os == 'ubuntu' - uses: actions/cache@v5 - with: - path: | - ${{ env.HOME }}/.cache/electron-builder - ${{ env.HOME }}/.cache/electron - key: ${{ runner.os }}-electron-builder-${{ hashFiles('**/electron-builder.yml') }} - restore-keys: | - ${{ runner.os }}-electron-builder- - if-no-files-found: ignore - - name: NPM offline setup shell: bash run: | @@ -67,8 +50,16 @@ jobs: - name: Install npm dependencies run: npm install --prefer-offline --no-audit --no-fund + #Собираем Kernel чтобы свежие файлы попали в папку out - name: Build the application run: npm run kernel:linux + + #Собираем сервисные пакеты для всех платформ + - name: Build SP + shell: bash + run: | + chmod +x "$GITHUB_WORKSPACE/build-packs.sh" + sh "$GITHUB_WORKSPACE/build-packs.sh" #Загружаем на удаленный сервер по SSH используя scp и пароль из секретов #Загружаем из двух папок dist/builds/darwin/x64 и dist/builds/darwin/arm64, так как electron-builder может создавать разные файлы для разных архитектур - name: Upload to SSH diff --git a/build-packs.sh b/build-packs.sh index e9c2cde..0640b9a 100644 --- a/build-packs.sh +++ b/build-packs.sh @@ -1,8 +1,7 @@ #/bin/bash echo "Using directory: $(pwd)" current_dir=$(pwd) -# Run npm with a timeout using perl (cross-platform alternative to 'timeout') -perl -e 'alarm shift; $SIG{ALRM}=sub{kill INT => -$$}; exec @ARGV' 10 npm run start + echo "Build complete. Packing service packs..." APP_VERSION=$(grep -o 'APP_VERSION *= *"[^"]*' "$current_dir/app/version.ts" | sed 's/APP_VERSION *= *"//') -- 2.49.1 From 2a5e297478f4fe29a6ec9cfdbecacb9aea46c55d Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 18:21:14 +0200 Subject: [PATCH 40/41] 1.0.2-1.4.9 --- .gitea/workflows/darwin.yaml | 4 ++-- package.json | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.gitea/workflows/darwin.yaml b/.gitea/workflows/darwin.yaml index 3801103..89705c4 100644 --- a/.gitea/workflows/darwin.yaml +++ b/.gitea/workflows/darwin.yaml @@ -58,13 +58,13 @@ jobs: run: | chmod +x "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" sh "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ - -l "$GITHUB_WORKSPACE/dist/builds/darwin/x64/Rosetta-*.dmg" \ + -l "$GITHUB_WORKSPACE/dist/builds/darwin/x64/Rosetta-*.pkg" \ -r "${{ secrets.SSH_TARGET_DIR }}/darwin/x64" \ -s "${{ secrets.SSH_HOST }}" \ -u "${{ secrets.SSH_USERNAME }}" \ -p '${{ secrets.SSH_PASSWORD }}' sh "$GITHUB_WORKSPACE/.gitea/workflows/sshupload.sh" \ - -l "$GITHUB_WORKSPACE/dist/builds/darwin/arm64/Rosetta-*.dmg" \ + -l "$GITHUB_WORKSPACE/dist/builds/darwin/arm64/Rosetta-*.pkg" \ -r "${{ secrets.SSH_TARGET_DIR }}/darwin/arm64" \ -s "${{ secrets.SSH_HOST }}" \ -u "${{ secrets.SSH_USERNAME }}" \ diff --git a/package.json b/package.json index ec06be4..833f9be 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "zip", "pkg" ], - "artifactName": "/builds/darwin/${arch}/Rosetta-${version}.${ext}", + "artifactName": "builds/darwin/${arch}/Rosetta-${version}.${ext}", "publish": null }, "pkg": { @@ -33,8 +33,10 @@ "linux": { "icon": "icons/png/256x256.png", "target": [ - "AppImage" - ] + "AppImage", + "zip" + ], + "artifactName": "builds/linux/${arch}/Rosetta-${version}.${ext}" }, "win": { "icon": "icons/win/icon.ico", @@ -42,7 +44,7 @@ "zip", "nsis" ], - "artifactName": "/builds/win/${arch}/Rosetta-${version}.${ext}" + "artifactName": "builds/win/${arch}/Rosetta-${version}.${ext}" }, "nsis": { "oneClick": false, @@ -64,7 +66,7 @@ "kernel:darwin-arm64": "electron-vite build && electron-builder --mac --arm64", "kernel:darwin-x64": "electron-vite build && electron-builder --mac --x64", "kernel:mac": "npm run kernel:darwin-x64 && npm run kernel:darwin-arm64", - "kernel:linux": "electron-vite build && electron-builder --linux --x64 --arm64" + "kernel:linux": "mkdir -p dist/builds/linux/x86_64 dist/builds/linux/arm64 dist/builds/linux/x64 && electron-vite build && electron-builder --linux --x64 --arm64" }, "dependencies": { "@electron-toolkit/preload": "^3.0.1", -- 2.49.1 From c50f3f00971471220eae75639e4c250f93f4fc13 Mon Sep 17 00:00:00 2001 From: RoyceDa Date: Wed, 18 Feb 2026 18:50:33 +0200 Subject: [PATCH 41/41] Linux Runner --- package.json | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 833f9be..cb48eb0 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "appId": "im.rosetta", "icon": "icons/mac/icon.icns", "target": [ - "zip", "pkg" ], "artifactName": "builds/darwin/${arch}/Rosetta-${version}.${ext}", @@ -33,15 +32,13 @@ "linux": { "icon": "icons/png/256x256.png", "target": [ - "AppImage", - "zip" + "AppImage" ], "artifactName": "builds/linux/${arch}/Rosetta-${version}.${ext}" }, "win": { "icon": "icons/win/icon.ico", "target": [ - "zip", "nsis" ], "artifactName": "builds/win/${arch}/Rosetta-${version}.${ext}" @@ -62,11 +59,11 @@ "start": "electron-vite preview", "postinstall": "electron-builder install-app-deps", "build:unpack": "electron-vite build && electron-builder --dir", - "kernel:win": "electron-vite build && electron-builder --win --x64", + "kernel:win": "mkdir -p dist/builds/win32/x64 && electron-vite build && electron-builder --win --x64", "kernel:darwin-arm64": "electron-vite build && electron-builder --mac --arm64", "kernel:darwin-x64": "electron-vite build && electron-builder --mac --x64", - "kernel:mac": "npm run kernel:darwin-x64 && npm run kernel:darwin-arm64", - "kernel:linux": "mkdir -p dist/builds/linux/x86_64 dist/builds/linux/arm64 dist/builds/linux/x64 && electron-vite build && electron-builder --linux --x64 --arm64" + "kernel:mac": "mkdir -p dist/builds/darwin/arm64 dist/builds/darwin/x64 && npm run kernel:darwin-x64 && npm run kernel:darwin-arm64", + "kernel:linux": "mkdir -p dist/builds/linux/x64 dist/builds/linux/arm64 dist/builds/linux/x86_64 && electron-vite build && electron-builder --linux --x64 --arm64 && if [ -d dist/builds/linux/x86_64 ]; then mkdir -p dist/builds/linux/x64 && mv dist/builds/linux/x86_64/* dist/builds/linux/x64/ 2>/dev/null || true; rmdir dist/builds/linux/x86_64 2>/dev/null || true; fi" }, "dependencies": { "@electron-toolkit/preload": "^3.0.1", -- 2.49.1