mirror of
https://github.com/anejolov/WinDeckHelper.git
synced 2026-06-13 04:05:06 +03:00
100 lines
3.2 KiB
YAML
100 lines
3.2 KiB
YAML
name: Add EXE to Release Assets
|
|
'on':
|
|
release:
|
|
types:
|
|
- published
|
|
jobs:
|
|
build:
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
- name: Install WinRAR
|
|
run: |
|
|
echo "WinRAR installation check."
|
|
if (!(Get-Command rar)) {
|
|
Write-Error "WinRAR not found. Ensure it is installed and in the PATH."
|
|
exit 1
|
|
}
|
|
- name: Create Windeckhelper directory
|
|
run: mkdir %TEMP%\Windeckhelper
|
|
- name: Copy files to archive
|
|
run: |
|
|
Copy-Item *.ps1 %TEMP%\Windeckhelper\
|
|
Copy-Item *.txt %TEMP%\Windeckhelper\
|
|
- name: Create SFX archive
|
|
run: >
|
|
$archiveName = "Windeckhelper.exe"
|
|
|
|
$sfxIcon = "icon.ico"
|
|
|
|
$scriptPath = "%TEMP%\Windeckhelper\Windeckhelper.ps1"
|
|
|
|
$tempList = "%TEMP%\filelist.txt"
|
|
|
|
Get-ChildItem %TEMP%\Windeckhelper\* | ForEach-Object
|
|
{$_.FullName} | Out-File $tempList
|
|
|
|
$command = "rar a -sfx -zrar.txt -r $archiveName @$tempList"
|
|
|
|
Invoke-Expression $command
|
|
|
|
Remove-Item $tempList
|
|
env:
|
|
RAR_PATH: 'C:\Program Files\WinRAR\rar.exe'
|
|
- name: Create rar.txt for SFX options
|
|
run: >
|
|
$exeName = "Windeckhelper-${{ github.event.release.tag_name
|
|
}}.exe"
|
|
|
|
$rarTxt = @"
|
|
|
|
Path=%TEMP%\Windeckhelper
|
|
|
|
Setup=PowerShell -NoProfile -ExecutionPolicy Bypass -Command "&
|
|
.\Windeckhelper.ps1"
|
|
|
|
Silent=1
|
|
|
|
Overwrite=1
|
|
|
|
Title=$exeName
|
|
|
|
Icon=$Env:GITHUB_WORKSPACE\icon.ico
|
|
|
|
AdminAccess=1
|
|
|
|
"@
|
|
|
|
$rarTxt | Out-File rar.txt
|
|
|
|
Rename-Item Windeckhelper.exe $exeName
|
|
- name: Upload EXE to Release Assets
|
|
uses: actions/github-script@v6
|
|
with:
|
|
script: |
|
|
const fs = require('fs').promises;
|
|
const github = context.github;
|
|
const context = github.context;
|
|
const tagName = '${{ github.event.release.tag_name }}';
|
|
const exeName = `Windeckhelper-${tagName}.exe`;
|
|
const exePath = `./${exeName}`;
|
|
try {
|
|
const release = await github.rest.repos.getReleaseByTag({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
tag: tagName,
|
|
});
|
|
const data = await fs.readFile(exePath);
|
|
await github.rest.repos.uploadReleaseAsset({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
release_id: release.data.id,
|
|
name: exeName,
|
|
data: data,
|
|
});
|
|
console.log(`EXE ${exeName} uploaded to release ${tagName}`);
|
|
} catch (error) {
|
|
console.error('Error uploading EXE:', error);
|
|
}
|