Update main.yml

This commit is contained in:
Kvintilyanov Aleksandr
2025-03-13 14:39:16 +03:00
committed by GitHub
parent 5b3e9adbdf
commit ee424dfa68
+17 -8
View File
@@ -10,6 +10,9 @@ on:
release:
types: [published] # Запуск при создании релиза вручную через интерфейс GitHub
env:
BASE_FILE_NAME: WindeckHelper.exe # Базовое имя файла
jobs:
build:
runs-on: windows-latest
@@ -23,8 +26,9 @@ jobs:
choco install winrar -y
- name: Create self-extracting archive with WinRAR
id: create_archive
run: |
$archiveName = "WindeckHelper.exe"
$archiveName = "${{ env.BASE_FILE_NAME }}"
$sourceFiles = Get-ChildItem -Path . -Recurse -Exclude .git, .github | ForEach-Object { $_.FullName }
$iconPath = Resolve-Path -Path "Windeckicon.ico" # Полный путь к иконке
$sfxConfig = @"
@@ -37,12 +41,13 @@ jobs:
Icon=$iconPath
"@
Set-Content -Path "sfxconfig.txt" -Value $sfxConfig
& "C:\Program Files\WinRAR\WinRAR.exe" a -r -sfx -iicon"$iconPath" -z"sfxconfig.txt" -ep1 $archiveName $sourceFiles
& "C:\Program Files\WinRAR\WinRAR.exe" a -r -sfx -z"sfxconfig.txt" -ep1 $archiveName $sourceFiles
Remove-Item -Path "sfxconfig.txt"
echo "archiveName=$archiveName" >> $env:GITHUB_OUTPUT # Передаём имя файла в outputs
- name: Verify installer creation
run: |
$archiveName = "WindeckHelper.exe"
$archiveName = "${{ steps.create_archive.outputs.archiveName }}"
if (-Not (Test-Path -Path $archiveName)) {
Write-Error "Установщик не создан!"
exit 1
@@ -52,8 +57,8 @@ jobs:
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: WindeckHelper.exe
path: WindeckHelper.exe
name: WindeckHelper
path: ${{ steps.create_archive.outputs.archiveName }}
release:
runs-on: ubuntu-latest
@@ -80,7 +85,11 @@ jobs:
- name: Rename archive to include version
run: |
mv WindeckHelper.exe "WindeckHelper-${{ steps.get_version.outputs.version }}.exe"
baseName="${{ needs.build.outputs.archiveName }}"
version="${{ steps.get_version.outputs.version }}"
newName="${baseName%.exe}-${version}.exe"
mv "$baseName" "$newName"
echo "newName=$newName" >> $env:GITHUB_OUTPUT # Передаём новое имя файла в outputs
- name: Create release (only for workflow_dispatch)
if: github.event_name == 'workflow_dispatch'
@@ -100,6 +109,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url || steps.create_release.outputs.upload_url }}
asset_path: WindeckHelper-${{ steps.get_version.outputs.version }}.exe
asset_name: WindeckHelper-${{ steps.get_version.outputs.version }}.exe
asset_path: ${{ steps.rename_archive.outputs.newName }}
asset_name: ${{ steps.rename_archive.outputs.newName }}
asset_content_type: application/octet-stream