Skip to content

Commit 34840dc

Browse files
committed
Merge branch 'feature/gh_actions'
2 parents 29678b0 + 4dc74d3 commit 34840dc

File tree

3 files changed

+150
-4
lines changed

3 files changed

+150
-4
lines changed

.github/workflows/publish-release.yml

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

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)