-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (63 loc) · 2.33 KB
/
Copy pathrelease.yml
File metadata and controls
72 lines (63 loc) · 2.33 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 MS-DOS build
on:
workflow_dispatch:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
runs-on: windows-latest
steps:
- name: Check out source
uses: actions/checkout@v7
- name: Set up Open Watcom
uses: open-watcom/setup-watcom@v1
with:
version: "2.0"
target: "dos"
- name: Extract release notes
if: startsWith(github.ref, 'refs/tags/')
shell: pwsh
run: |
$tag = $env:GITHUB_REF_NAME
$text = Get-Content CHANGELOG.md -Raw
$pattern = "(?ms)^##\s+$([regex]::Escape($tag))\s+-\s+[^\r\n]+\r?\n(?<body>.*?)(?=^##\s+v|\z)"
$match = [regex]::Match($text, $pattern)
if (-not $match.Success -or [string]::IsNullOrWhiteSpace($match.Groups['body'].Value)) {
Write-Error "CHANGELOG.md is missing a non-empty section for $tag. Add '## $tag - YYYY-MM-DD' before tagging."
exit 1
}
New-Item -ItemType Directory -Force release | Out-Null
$body = "# $tag`n`n" + $match.Groups['body'].Value.Trim() + "`n"
Set-Content -LiteralPath release\RELEASE_NOTES.md -Value $body -Encoding UTF8
- name: Build executable
shell: pwsh
run: |
wmake -f build\wmakefile
New-Item -ItemType Directory -Force release | Out-Null
Copy-Item SHOOTER.EXE release\STELLAR.EXE
Copy-Item dist\README.TXT release\README.TXT
python build\mkfloppy.py release\STELLAR.IMG release\STELLAR.EXE release\README.TXT
Compress-Archive -Path release\STELLAR.EXE,release\STELLAR.IMG,release\README.TXT -DestinationPath release\Stellar-MS-DOS.zip -Force
- name: Upload build artifact
uses: actions/upload-artifact@v7
with:
name: Stellar-MS-DOS
path: |
release/STELLAR.EXE
release/STELLAR.IMG
release/README.TXT
release/Stellar-MS-DOS.zip
release/RELEASE_NOTES.md
- name: Publish GitHub release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v3
with:
body_path: release/RELEASE_NOTES.md
files: |
release/STELLAR.EXE
release/STELLAR.IMG
release/README.TXT
release/Stellar-MS-DOS.zip