-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (63 loc) · 2.26 KB
/
Copy pathrelease.yml
File metadata and controls
72 lines (63 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Release
on:
push:
tags:
- 'v*.*.*'
permissions:
contents: write
jobs:
build-and-release:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version from tag
id: version
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
$ver = $tag.TrimStart('v')
echo "VERSION=$ver" >> $env:GITHUB_OUTPUT
echo "TAG=$tag" >> $env:GITHUB_OUTPUT
- name: Build standalone script
shell: pwsh
run: |
.\build.ps1 -OutputFile "WinSwift-Standalone.ps1"
Write-Host "Standalone script built successfully."
- name: Create release ZIP
shell: pwsh
run: |
$ver = "${{ steps.version.outputs.VERSION }}"
$zipName = "WinSwift-v$ver.zip"
$items = @("Assets", "Config", "Regfiles", "Schemas", "Scripts", "WinSwift.ps1", "Run.bat", "README.md", "CHANGELOG.md", "LICENSE")
$itemPaths = $items | ForEach-Object { Join-Path $PWD $_ } | Where-Object { Test-Path $_ }
Compress-Archive -Path $itemPaths -DestinationPath $zipName -Force
Write-Host "Created $zipName"
- name: Generate release notes from CHANGELOG
id: release_notes
shell: pwsh
run: |
$content = Get-Content CHANGELOG.md -Raw
# Extract section for this version
$ver = "${{ steps.version.outputs.VERSION }}"
if ($content -match "(?s)## \[$ver\].*?(?=\n## \[|\Z)") {
$notes = $Matches[0].Trim()
} else {
$notes = "See CHANGELOG.md for details."
}
# Write to file to avoid multiline env var issues
Set-Content -Path release_notes.md -Value $notes
Write-Host "Release notes extracted."
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.TAG }}
name: WinSwift v${{ steps.version.outputs.VERSION }}
body_path: release_notes.md
draft: false
prerelease: false
files: |
WinSwift-v${{ steps.version.outputs.VERSION }}.zip
WinSwift-Standalone.ps1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}