Skip to content

Commit f8ee9ff

Browse files
committed
Add GitHub Workflow to build installer and create release
1 parent 3c210b3 commit f8ee9ff

8 files changed

Lines changed: 270 additions & 115 deletions

File tree

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,19 @@ param(
22
[string]$version
33
)
44

5-
$version_underscored = $version -replace '\.', '_'
6-
$setup_link = "https://github.com/Ellendar/Z2Randomizer/releases/download/$version/Z2Randomizer_${version_underscored}.msi"
5+
$setup_link = "https://github.com/Ellendar/Z2Randomizer/releases/download/$version/Z2Randomizer-$version-Windows-Installer.msi"
76
$pub_date = Get-Date -Format "dddd, dd MMMM yyyy"
87

9-
# Update appcast.xml
108
$file = "appcast.xml"
119
$content = Get-Content $file
12-
13-
$firstMatch = $content | Select-String -Pattern '^\s*<item>' | Select-Object -First 1
14-
$index = $firstMatch.LineNumber - 1
15-
$before = $content[0..($index - 1)]
16-
$after = $content[$index..($content.Length - 1)]
17-
1810
if ($content -like "*<title>Version $version</title>*") {
19-
Write-Host "Version $version already exists in appcast.xml - ending."
20-
exit 0
21-
}
22-
23-
$app_cast_item = @"
11+
Write-Host "Version $version already exists in appcast.xml"
12+
} else {
13+
$firstMatch = $content | Select-String -Pattern '^\s*<item>' | Select-Object -First 1
14+
$index = $firstMatch.LineNumber - 1
15+
$before = $content[0..($index - 1)]
16+
$after = $content[$index..($content.Length - 1)]
17+
$app_cast_item = @"
2418
<item>
2519
<title>Version $version</title>
2620
<description>
@@ -32,26 +26,32 @@ $app_cast_item = @"
3226
<enclosure url=""$setup_link"" sparkle:version=""$version"" />
3327
</item>
3428
"@
35-
36-
Set-Content $file ($before + $app_cast_item + $after)
29+
Set-Content $file ($before + $app_cast_item + $after)
30+
}
31+
git add $file
3732

3833
$file = "Directory.Build.targets"
3934
(Get-Content $file) |
4035
ForEach-Object {
4136
$_ -replace '<Version>.*?</Version>', "<Version>$version</Version>"
4237
} | Set-Content $file
38+
git add $file
4339

4440
$file = "README.md"
4541
(Get-Content $file) |
4642
ForEach-Object {
4743
$_ -replace '\[Download\]\([^)]*\)', "[Download]($setup_link)"
4844
} | Set-Content $file
45+
git add $file
4946

5047
$file = "Setup1/Setup1.vdproj"
5148
(Get-Content $file) |
5249
ForEach-Object {
5350
$_ -replace '"ProductVersion"\s*=\s*"8:.*?"', "`"ProductVersion`" = `"8:$version`""
5451
} | Set-Content $file
52+
git add $file
5553

56-
#git add .
57-
#git commit -m "Update version to $version"
54+
# Only commit if some change was actually staged (to prevent setting error level)
55+
if (git diff --cached --name-only) {
56+
git commit -m "$version Release"
57+
}

.github/workflows/build-debug.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
name: Package and Upload Z2Randomizer Debug
1+
name: Build Z2Randomizer Debug
22

33
on:
44
push:
55
branches-ignore:
6-
- testing
7-
tags-ignore:
8-
- '**'
6+
- testing
97
pull_request:
108

119
env:
@@ -19,31 +17,33 @@ jobs:
1917
strategy:
2018
matrix:
2119
platform: [
22-
{ os: ubuntu-latest, arch: x64 },
20+
#{ os: windows-latest, arch: x64 },
21+
#{ os: macos-14, arch: arm64 },
22+
{ os: ubuntu-latest, arch: x64 }, # the fastest one (just to make sure it builds)
2323
]
2424
dotnet-version: [ '8.0.x' ]
2525

2626
runs-on: ${{ matrix.platform.os }}
2727
steps:
2828
- name: Checkout codebase
29-
uses: actions/checkout@v2
29+
uses: actions/checkout@v6
3030
with:
3131
submodules: recursive
3232

3333
- name: Setup dotnet ${{ matrix.dotnet-version }}
34-
uses: actions/setup-dotnet@v3
34+
uses: actions/setup-dotnet@v5
3535
with:
3636
dotnet-version: ${{ matrix.dotnet-version }}
3737

38-
- name: Publish Desktop Debug
39-
run: dotnet publish -c Debug -o CrossPlatformUI/bin/publish CrossPlatformUI.Desktop/CrossPlatformUI.Desktop.csproj
38+
- name: Build Desktop Debug
39+
run: dotnet publish -c Debug -o CrossPlatformUI.Desktop/bin/publish CrossPlatformUI.Desktop/CrossPlatformUI.Desktop.csproj
4040

41-
- name: Upload Linux Build To Artifacts
41+
- name: Upload Regular Build To Artifacts
4242
uses: actions/upload-artifact@v4
4343
with:
4444
name: Z2Randomizer-${{ matrix.platform.os }}-${{ matrix.platform.arch }}-Debug
4545
# don't compress hard since it's not a real release
4646
compression-level: 6
4747
path: |
48-
CrossPlatformUI/bin/publish
48+
CrossPlatformUI.Desktop/bin/publish
4949
!**/*.pdb

.github/workflows/build-release.yaml

Lines changed: 0 additions & 80 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build Z2Randomizer Latest
2+
3+
on:
4+
push:
5+
branches:
6+
- testing
7+
8+
env:
9+
# I'm not a fan of the telemetry as-is, but this also suppresses some lines in the build log.
10+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
11+
# This removes even more spurious lines.
12+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
13+
14+
jobs:
15+
build:
16+
strategy:
17+
matrix:
18+
platform: [
19+
{ os: windows-latest, arch: x64 },
20+
{ os: macos-14, arch: arm64 },
21+
{ os: ubuntu-latest, arch: x64 },
22+
]
23+
dotnet-version: [ '8.0.x' ]
24+
25+
runs-on: ${{ matrix.platform.os }}
26+
steps:
27+
- name: Checkout codebase
28+
uses: actions/checkout@v6
29+
with:
30+
submodules: recursive
31+
32+
- name: Setup dotnet ${{ matrix.dotnet-version }}
33+
uses: actions/setup-dotnet@v5
34+
with:
35+
dotnet-version: ${{ matrix.dotnet-version }}
36+
37+
- name: Build Desktop
38+
run: dotnet publish -c Release -o CrossPlatformUI.Desktop/bin/publish CrossPlatformUI.Desktop/CrossPlatformUI.Desktop.csproj
39+
40+
- name: Upload Regular Build To Artifacts
41+
uses: actions/upload-artifact@v4
42+
with:
43+
name: Z2Randomizer-${{ matrix.platform.os }}-${{ matrix.platform.arch }}
44+
compression-level: 9
45+
path: |
46+
CrossPlatformUI.Desktop/bin/publish
47+
!**/*.pdb

0 commit comments

Comments
 (0)