This commit is contained in:
RoyceDa
2026-02-17 20:37:45 +02:00
parent b0998990fd
commit e39d084dad

View File

@@ -27,12 +27,47 @@ jobs:
- name: Build the application - name: Build the application
run: npm run kernel:win run: npm run kernel:win
- name: Upload build to SFTP - name: Upload build to SFTP
uses: wlixcc/SFTP-Deploy-Action@v1.2.4 shell: pwsh
with: run: |
server: ${{ secrets.SSH_HOST }} # Установка модуля Posh-SSH
username: ${{ secrets.SSH_USERNAME }} Install-Module -Name Posh-SSH -Force -Scope CurrentUser -AllowClobber
password: ${{ secrets.SSH_PASSWORD }}
port: ${{ secrets.SSH_PORT }} # Получаем файл для загрузки
local_path: ./dist/builds/win/x64/* $file = Get-ChildItem -Path "dist/builds/win/x64/Rosetta-*.exe" | Select-Object -First 1
remote_path: ${{ secrets.SSH_TARGET_DIR }}
sftpArgs: '-o ConnectTimeout=5' 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!"