Skip to content

Commit

Permalink
リリースワークフローで".app"を作成するようにした
Browse files Browse the repository at this point in the history
  • Loading branch information
yuto-trd committed Mar 28, 2024
1 parent 8d8d4f9 commit 637e481
Show file tree
Hide file tree
Showing 6 changed files with 105 additions and 50 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
rid: [linux_x64, win_x64, osx_x64]
rid: [linux_x64, win_x64, osx_x64, osx_arm64]
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
35 changes: 34 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
runs-on: windows-latest
strategy:
matrix:
rid: [linux_x64, win_x64]
rid: [linux_x64, win_x64, osx_arm64]

steps:
- name: Checkout
Expand Down Expand Up @@ -176,6 +176,39 @@ jobs:
name: beutl_${{needs.determine-version.outputs.simpleVer}}-${{needs.determine-version.outputs.revision}}ubuntu22.04_amd64.deb
path: ./packages/beutl_${{needs.determine-version.outputs.simpleVer}}-${{needs.determine-version.outputs.revision}}ubuntu22.04_amd64.deb

build-app-bundle:
runs-on: macos-latest
strategy:
matrix:
rid: [osx_x64, osx_arm64]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
global-json-file: global.json

- name: Restore
run: ./build.cmd Restore

- name: Bundle
run: ./build.cmd bundleApp --runtime ${{matrix.rid}} --skip restore

- name: Zip
run: |
mkdir artifacts
zip artifacts/Beutl.${{matrix.rid}}.app.zip -r output/AppBundle/Beutl.app
- name: Save
uses: actions/upload-artifact@v4
with:
name: Beutl.${{matrix.rid}}.app.zip
path: ./artifacts/Beutl.${{matrix.rid}}.app.zip

build-nuget:
needs: [determine-version]
runs-on: windows-latest
Expand Down
32 changes: 4 additions & 28 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,37 +70,11 @@
"enum": [
"linux_arm",
"linux_arm64",
"linux_musl_x64",
"linux_x64",
"osx_10_10_x64",
"osx_10_11_x64",
"osx_10_12_x64",
"osx_10_13_x64",
"osx_10_14_x64",
"osx_10_15_x64",
"osx_11_0_arm64",
"osx_11_0_x64",
"osx_12_arm64",
"osx_12_x64",
"osx_arm64",
"osx_x64",
"rhel_6_x64",
"rhel_x64",
"tizen",
"tizen_4_0_0",
"tizen_5_0_0",
"win_arm",
"win_arm64",
"win_x64",
"win_x86",
"win10_arm",
"win10_arm64",
"win10_x64",
"win10_x86",
"win7_x64",
"win7_x86",
"win81_arm",
"win81_x64",
"win81_x86"
"win_x64"
]
},
"SelfContained": {
Expand All @@ -113,6 +87,7 @@
"type": "string",
"enum": [
"BuildInstaller",
"BundleApp",
"Clean",
"Compile",
"Publish",
Expand All @@ -132,6 +107,7 @@
"type": "string",
"enum": [
"BuildInstaller",
"BundleApp",
"Clean",
"Compile",
"Publish",
Expand Down
40 changes: 22 additions & 18 deletions nukebuild/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ partial class Build : NukeBuild
Configuration Configuration = Configuration.Release;

[Parameter()]
DotNetRuntimeIdentifier Runtime = null;
RuntimeIdentifier Runtime = null;

[Parameter()]
bool SelfContained = false;
Expand Down Expand Up @@ -81,11 +81,6 @@ private string GetTFM()
.DependsOn(Restore)
.Executes(() =>
{
if (!IsSupportedRid(Runtime))
{
throw new NotSupportedException("This runtime is not yet supported.");
}

AbsolutePath mainProj = SourceDirectory / "Beutl" / "Beutl.csproj";
AbsolutePath mainOutput = OutputDirectory / "Beutl";

Expand All @@ -94,8 +89,8 @@ private string GetTFM()
DotNetPublish(s => s
.EnableNoRestore()
.When(Runtime != null, s => s.SetRuntime(Runtime).SetSelfContained(SelfContained))
.When(Runtime == DotNetRuntimeIdentifier.win_x64, s => s.SetFramework($"{tfm}-windows"))
.When(Runtime != DotNetRuntimeIdentifier.win_x64, s => s.SetFramework(tfm))
.When(Runtime == RuntimeIdentifier.win_x64, s => s.SetFramework($"{tfm}-windows"))
.When(Runtime != RuntimeIdentifier.win_x64, s => s.SetFramework(tfm))
.SetConfiguration(Configuration)
.SetProject(mainProj)
.SetOutput(mainOutput)
Expand Down Expand Up @@ -184,14 +179,23 @@ private string GetTFM()
.SetScriptFile(RootDirectory / "nukebuild/beutl-setup.iss"));
});

bool IsSupportedRid(DotNetRuntimeIdentifier rid)
{
return rid == DotNetRuntimeIdentifier.linux_x64
|| rid == DotNetRuntimeIdentifier.win_x64
|| rid == DotNetRuntimeIdentifier.win10_x64
|| rid == DotNetRuntimeIdentifier.win7_x64
|| rid == DotNetRuntimeIdentifier.win81_x64
|| rid == DotNetRuntimeIdentifier.osx_x64
|| rid == null;
}
Target BundleApp => _ => _
.Executes(() =>
{
// dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-arm64 -p:TargetFramework=net8.0 -p:UseAppHost=true -p:SelfContained=true
AbsolutePath directory = SourceDirectory / "Beutl";
AbsolutePath output = OutputDirectory / "AppBundle";
string tfm = GetTFM();
DotNetMSBuild(s => s
.SetProcessWorkingDirectory(directory)
.SetTargets("BundleApp")
.SetConfiguration(Configuration)
.SetProperty("PublishDir", output)
.SetProperty("CFBundleVersion", NerdbankVersioning.AssemblyFileVersion)
.SetProperty("CFBundleShortVersionString", NerdbankVersioning.AssemblyFileVersion)
.SetProperty("RuntimeIdentifier", Runtime)
.SetProperty("TargetFramework", tfm)
.SetProperty("UseAppHost", true)
.SetProperty("SelfContained", true));
});
}
41 changes: 41 additions & 0 deletions nukebuild/RuntimeIdentifier.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

using System.ComponentModel;

[TypeConverter(typeof(TypeConverter<RuntimeIdentifier>))]
public class RuntimeIdentifier : Enumeration
{
public static RuntimeIdentifier win_x64 = new()
{
Value = "win-x64"
};

public static RuntimeIdentifier win_arm64 = new()
{
Value = "win-arm64"
};

public static RuntimeIdentifier linux_x64 = new()
{
Value = "linux-x64"
};

public static RuntimeIdentifier linux_arm = new()
{
Value = "linux-arm"
};

public static RuntimeIdentifier linux_arm64 = new()
{
Value = "linux-arm64"
};

public static RuntimeIdentifier osx_x64 = new()
{
Value = "osx-x64"
};

public static RuntimeIdentifier osx_arm64 = new()
{
Value = "osx-arm64"
};
}
5 changes: 3 additions & 2 deletions src/Beutl/Beutl.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@
<CFBundleName>Beutl</CFBundleName>
<CFBundleDisplayName>Beutl</CFBundleDisplayName>
<CFBundleIdentifier>net.beditor.beutl</CFBundleIdentifier>
<CFBundleVersion>1.0.0</CFBundleVersion>
<CFBundleShortVersionString>1.0.0</CFBundleShortVersionString>
<!-- スクリプトから指定 -->
<!-- <CFBundleVersion>$(AssemblyVersion)</CFBundleVersion> -->
<!-- <CFBundleShortVersionString>$(AssemblyVersion)</CFBundleShortVersionString> -->
<CFBundlePackageType>APPL</CFBundlePackageType>
<CFBundleSignature>????</CFBundleSignature>
<CFBundleExecutable>Beutl</CFBundleExecutable>
Expand Down

0 comments on commit 637e481

Please sign in to comment.