Skip to content

Commit 8f1716a

Browse files
committed
Merge branch 'feature/gh_actions'
2 parents 29678b0 + 871e2c3 commit 8f1716a

File tree

3 files changed

+145
-4
lines changed

3 files changed

+145
-4
lines changed

.github/workflows/publish-release.yml

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: 'Publish Release'
2+
on:
3+
push:
4+
tags:
5+
- v*
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: 'Version tag in format x.y.z[-pre]'
10+
required: true
11+
type: string
12+
env:
13+
dotnet_version: '8.0'
14+
jobs:
15+
publish:
16+
strategy:
17+
matrix:
18+
os: [windows-latest, ubuntu-latest, macos-latest]
19+
include:
20+
- os: windows-latest
21+
configuration: Release
22+
target: '-windows'
23+
rid: win-x64
24+
command: publish
25+
- os: ubuntu-latest
26+
configuration: Linux
27+
target: ''
28+
rid: linux-x64
29+
command: publish
30+
- os: macos-latest
31+
configuration: MacOS
32+
target: ''
33+
rid: 'osx-arm64'
34+
command: 'build -t:BundleApp'
35+
runs-on: '${{ matrix.os }}'
36+
env:
37+
version_full: '${{ github.ref_name }}'
38+
version_short: '${{ github.ref_name }}'
39+
artifact_name: 'ps3-disc-dumper_vX.Y.Z.zip'
40+
permissions:
41+
contents: write
42+
steps:
43+
- uses: actions/checkout@v4
44+
- name: 'Replace full version with custom input value'
45+
if: '${{ inputs.version }}'
46+
shell: pwsh
47+
run: 'Write-Output "version_full=${{ inputs.version }}" >> $env:GITHUB_ENV'
48+
- name: 'Generate short version'
49+
shell: pwsh
50+
run: |
51+
$ver = [SemVer]('${{ env.version_full }}'.TrimStart('v'))
52+
$short_ver = "$($ver.Major).$($ver.Minor).$($ver.Patch)"
53+
Write-Host "Got $short_ver from ${{ env.version_full }}"
54+
Write-Output "version_short=$short_ver" >> $env:GITHUB_ENV
55+
- uses: actions/setup-dotnet@v3
56+
with:
57+
dotnet-version: '${{ env.dotnet_version }}.x'
58+
- name: "Download current redump snapshot"
59+
shell: pwsh
60+
run: |
61+
$uri = 'http://redump.org/keys/ps3/'
62+
$response = Invoke-WebRequest -Uri $uri -Method HEAD
63+
$fname = $response.Headers['Content-Disposition'].Split('=', 2)[1].Trim('"')
64+
Invoke-WebRequest -Uri $uri -OutFile "$fname"
65+
Write-Host "Got $fname"
66+
- name: 'Build release'
67+
run: >-
68+
dotnet ${{ matrix.command }}
69+
-v:q
70+
--runtime ${{ matrix.rid }}
71+
--framework ${{ env.dotnet_version }}${{ matrix.target }}
72+
--self-contained
73+
--configuration ${{ matrix.configuration}}
74+
--output distrib
75+
UI.Avalonia/UI.Avalonia.csproj
76+
-p:PublishTrimmed=False
77+
-p:PublishSingleFile=True
78+
-p:DebugSymbols=False
79+
-p:VersionPrefix=${{ env.version_short }}
80+
-p:Version=${{ env.version_full }}
81+
- name: 'Make artifact'
82+
shell: pwsh
83+
run: |
84+
cd distrib
85+
$artifact_name = "ps3-disc-dumper_v${{ env.version_full }}.zip"
86+
if ($IsWindows)
87+
{
88+
$artifact_name = "ps3-disc-dumper_windows_v${{ env.version_full }}.zip"
89+
Compress-Archive -LiteralPath ps3-disc-dumper.exe -DestinationPath "$artifact_name" -CompressionLevel Optimal -Force
90+
}
91+
else if ($IsLinux) # Compress-Archive does not preserve rwx attributes, so use zip on *nix
92+
{
93+
$artifact_name = "ps3-disc-dumper_linux_v${{ env.version_full }}.zip"
94+
zip -v9 "$artifact_name" ps3-disc-dumper
95+
}
96+
else if ($IsMacOs)
97+
{
98+
$artifact_name = "ps3-disc-dumper_macos_v${{ env.version_full }}.zip"
99+
zip -vr9 "$artifact_name" "PS3 Disc Dumper.app/" -x "*.DS_Store"
100+
}
101+
Write-Output "artifact_name=$artifact_name" >> $env:GITHUB_ENV
102+
- name: 'Create or update GitHub release draft'
103+
if: ${{ inputs.version }}
104+
uses: ncipollo/release-action@v1
105+
with:
106+
draft: true
107+
prerelease: true
108+
allowUpdates: true
109+
generateReleaseNotes: true
110+
artifacts: 'distrib/ps3-disc-dumper_*.zip'
111+
artifactContentType: application/zip
112+
replacesArtifacts: true
113+
omitBodyDuringUpdate: true
114+
omitNameDuringUpdate: true
115+
omitPrereleaseDuringUpdate: true
116+
- name: 'Create or update GitHub custom release draft'
117+
if: ${{ github.event_name == 'push' }}
118+
uses: ncipollo/release-action@v1
119+
with:
120+
commit: '${{ github.sha }}'
121+
tag: '${{ env.version_full }}'
122+
draft: true
123+
prerelease: true
124+
allowUpdates: true
125+
generateReleaseNotes: true
126+
artifacts: 'distrib/ps3-disc-dumper_*.zip'
127+
artifactContentType: application/zip
128+
replacesArtifacts: true
129+
omitBodyDuringUpdate: true
130+
omitNameDuringUpdate: true
131+
omitPrereleaseDuringUpdate: true
132+
133+

Ps3DiscDumper/Dumper.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Linq;
77
using System.Management;
88
using System.Net.Http;
9+
using System.Reflection;
910
using System.Runtime.InteropServices;
1011
using System.Runtime.Versioning;
1112
using System.Text;
@@ -29,7 +30,11 @@ namespace Ps3DiscDumper;
2930

3031
public class Dumper: IDisposable
3132
{
32-
public const string Version = "4.1.4";
33+
public static readonly string Version = Assembly.GetEntryAssembly()?
34+
.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?
35+
.InformationalVersion
36+
.Split('+', 2)[0]
37+
?? "x.y.x-unknown";
3338

3439
static Dumper() => Log.Info("PS3 Disc Dumper v" + Version);
3540

UI.Avalonia/UI.Avalonia.csproj

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1212
<Configurations>Debug;Release;MacOS;Linux</Configurations>
1313
<Platforms>AnyCPU</Platforms>
14+
<VersionPrefix>4.2.0</VersionPrefix>
15+
<Version>4.2.0-pre1</Version>
16+
<DebugType>PdbOnly</DebugType>
1417
</PropertyGroup>
1518

1619
<PropertyGroup Condition="'$(Configuration)' != 'Linux' And '$(Configuration)' != 'MacOS'">
@@ -33,8 +36,8 @@
3336
<CFBundleName>PS3 Disc Dumper</CFBundleName>
3437
<CFBundleDisplayName>PS3 Disc Dumper</CFBundleDisplayName>
3538
<CFBundleIdentifier>com.github.13xforever.ps3-disc-dumper</CFBundleIdentifier>
36-
<CFBundleVersion>4.1.4</CFBundleVersion>
37-
<CFBundleShortVersionString>$(CFBundleVersion)</CFBundleShortVersionString>
39+
<CFBundleVersion>$(Version)</CFBundleVersion>
40+
<CFBundleShortVersionString>$(VersionPrefix)</CFBundleShortVersionString>
3841
<CFBundleExecutable>ps3-disc-dumper</CFBundleExecutable>
3942
<CFBundleIconFile>icon.icns</CFBundleIconFile>
4043
</PropertyGroup>
@@ -67,7 +70,7 @@
6770
<PackageReference Include="Microsoft-WindowsAPICodePack-Shell" Version="1.1.5" />
6871
</ItemGroup>
6972
<ItemGroup Condition="'$(Configuration)' == 'MacOS'">
70-
<PackageReference Include="Dotnet.Bundle" Version="*" />
73+
<PackageReference Include="Dotnet.Bundle" Version="0.9.13" />
7174
<ContentWithTargetPath Include="Assets\icon.icns">
7275
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
7376
<TargetPath>icon.icns</TargetPath>

0 commit comments

Comments
 (0)