diff --git a/.github/workflows/daily-build.yml b/.github/workflows/daily-build.yml index 5b49b8772..6f27f52ef 100644 --- a/.github/workflows/daily-build.yml +++ b/.github/workflows/daily-build.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ae0f97579..e2d80b284 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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 diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 049050be3..9f4ef39b5 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -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": { @@ -113,6 +87,7 @@ "type": "string", "enum": [ "BuildInstaller", + "BundleApp", "Clean", "Compile", "Publish", @@ -132,6 +107,7 @@ "type": "string", "enum": [ "BuildInstaller", + "BundleApp", "Clean", "Compile", "Publish", diff --git a/nukebuild/Build.cs b/nukebuild/Build.cs index a1c983b2d..df65d031f 100644 --- a/nukebuild/Build.cs +++ b/nukebuild/Build.cs @@ -26,7 +26,7 @@ partial class Build : NukeBuild Configuration Configuration = Configuration.Release; [Parameter()] - DotNetRuntimeIdentifier Runtime = null; + RuntimeIdentifier Runtime = null; [Parameter()] bool SelfContained = false; @@ -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"; @@ -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) @@ -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)); + }); } diff --git a/nukebuild/RuntimeIdentifier.cs b/nukebuild/RuntimeIdentifier.cs new file mode 100644 index 000000000..41baf4efc --- /dev/null +++ b/nukebuild/RuntimeIdentifier.cs @@ -0,0 +1,41 @@ + +using System.ComponentModel; + +[TypeConverter(typeof(TypeConverter))] +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" + }; +} \ No newline at end of file diff --git a/src/Beutl/Beutl.csproj b/src/Beutl/Beutl.csproj index a18af1944..14ac1a3a2 100644 --- a/src/Beutl/Beutl.csproj +++ b/src/Beutl/Beutl.csproj @@ -19,8 +19,9 @@ Beutl Beutl net.beditor.beutl - 1.0.0 - 1.0.0 + + + APPL ???? Beutl