Files
WinDeckHelper/.github/workflows/main.yml
T
Kvintilyanov Aleksandr bcace6eaf4 Update main.yml
2025-03-13 14:04:42 +03:00

86 lines
2.7 KiB
YAML

name: Build and Deploy
on:
workflow_dispatch: # Ручной запуск
push:
branches:
- main # Запуск при пуше в ветку main
pull_request:
types: [opened, synchronize] # Запуск при создании или обновлении PR
jobs:
build:
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install WinRAR
run: |
choco install winrar -y
- name: Create self-extracting archive with WinRAR
run: |
$archiveName = "WindeckHelper.exe"
$sourceFiles = Get-ChildItem -Path . -Recurse -Exclude .git, .github | ForEach-Object { $_.FullName }
$iconPath = Resolve-Path -Path "Windeckicon.ico"
$sfxConfig = @"
Path=%TEMP%\Windeckhelper
Silent=1
Overwrite=1
Setup=PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& .\Windeckhelper.ps1"
TempMode=1
Title=WindeckHelper Installer
Icon=$iconPath
"@
Set-Content -Path "sfxconfig.txt" -Value $sfxConfig
& "C:\Program Files\WinRAR\WinRAR.exe" a -r -sfx -z"sfxconfig.txt" -ep1 $archiveName $sourceFiles
Remove-Item -Path "sfxconfig.txt"
- name: Upload artifact (for push or PR)
if: github.event_name == 'push' || github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: WindeckHelper.exe
path: WindeckHelper.exe
retention-days: 5
release:
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'workflow_dispatch' # Только для ручного запуска
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Get next version
id: version
run: |
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
VERSION=$(echo $LATEST_TAG | awk -F. '{printf "v%d.%d.%d", $1, $2, $3+1}')
echo "Next version: $VERSION"
echo "::set-output name=version::$VERSION"
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.version.outputs.version }}
release_name: Release ${{ steps.version.outputs.version }}
draft: false
prerelease: false
- name: Upload release asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: WindeckHelper.exe
asset_name: WindeckHelper.exe
asset_content_type: application/octet-stream