Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add standalone binary creation to release workflow #1176

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
strategy:
matrix:
rid: [ linux_x64, win_x64, osx_x64, osx_arm64 ]
standalone: [ true, false ]

steps:
- name: Checkout
Expand All @@ -49,6 +50,7 @@ jobs:
- name: Publish
run: |
./build.sh publish \
--self-contained ${{ matrix.standalone }} \
--runtime ${{ matrix.rid }} \
--skip restore \
--version ${{ needs.determine-version.outputs.nugetVer }} \
Expand Down Expand Up @@ -83,17 +85,24 @@ jobs:
gh api -H "Accept: application/octet-stream" -H "X-GitHub-Api-Version: 2022-11-28" /repos/indigo-san/opencvsharp-extern-builds/releases/assets/$ASSET_ID > libOpenCvSharpExtern.so

- name: Zip
run: ./build.sh zip --runtime ${{ matrix.rid }} --skip publish --version ${{ needs.determine-version.outputs.nugetVer }}
run: ./build.sh zip \
--runtime ${{ matrix.rid }} \
--self-contained ${{ matrix.standalone }} \
--skip publish \
--version ${{ needs.determine-version.outputs.nugetVer }}

- name: Save
uses: actions/upload-artifact@v4
with:
name: beutl-${{ matrix.rid }}-${{ needs.determine-version.outputs.semVer }}
name: beutl-${{ matrix.rid }}${{ matrix.standalone == 'true' && '-standalone' || '' }}-${{ needs.determine-version.outputs.semVer }}
path: ./artifacts/*.zip

build-windows-installer:
needs: [ determine-version, build-executable ]
runs-on: windows-latest
strategy:
matrix:
standalone: [ true, false ]

steps:
- name: Checkout
Expand All @@ -106,23 +115,26 @@ jobs:

- uses: actions/download-artifact@v4
with:
name: beutl-win_x64-${{ needs.determine-version.outputs.semVer }}
name: beutl-win_x64-standalone-${{ needs.determine-version.outputs.semVer }}
path: artifacts

- name: Extract zip
run: |
mkdir output/Beutl
cd output/Beutl
7z x ../../artifacts/beutl-win-x64-${{ needs.determine-version.outputs.semVer }}.zip
7z x ../../artifacts/beutl-win-x64-standalone-${{ needs.determine-version.outputs.semVer }}.zip

- name: Build installer
run: ./build.cmd build-installer --skip publish --assembly-version ${{ needs.determine-version.outputs.asmVer }}
run: ./build.cmd build-installer \
--skip publish \
--self-contained true \
--assembly-version ${{ needs.determine-version.outputs.asmVer }}

- name: Save installer
uses: actions/upload-artifact@v4
with:
name: beutl-setup
path: ./artifacts/beutl-setup.exe
name: beutl${{ matrix.standalone == 'true' && '-standalone' || '' }}-setup
path: ./artifacts/beutl${{ matrix.standalone == 'true' && '-standalone' || '' }}-setup.exe

build-debian-package:
needs: [ determine-version, build-executable ]
Expand Down Expand Up @@ -273,7 +285,7 @@ jobs:
- uses: ncipollo/release-action@v1
id: create_release
with:
artifacts: "artifacts/**/*.zip,artifacts/**/*.nupkg,artifacts/**/*.deb,artifacts/beutl-setup/beutl-setup.exe"
artifacts: "artifacts/**/*.zip,artifacts/**/*.deb,artifacts/beutl-setup/beutl-setup.exe,artifacts/beutl-standalone-setup/beutl-standalone-setup.exe"
draft: true
makeLatest: true
generateReleaseNotes: true
23 changes: 9 additions & 14 deletions nukebuild/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,19 @@
/// - JetBrains Rider https://nuke.build/rider
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode

public static int Main() => Execute<Build>(x => x.Compile);

[Parameter]
Configuration Configuration = Configuration.Release;
[Parameter] Configuration Configuration = Configuration.Release;

[Parameter]
RuntimeIdentifier Runtime = null;
[Parameter] RuntimeIdentifier Runtime = null;

[Parameter]
bool SelfContained = false;
[Parameter] bool SelfContained = false;

[Parameter]
string Version = "1.0.0";
[Parameter] string Version = "1.0.0";

[Parameter]
string AssemblyVersion = "1.0.0.0";
[Parameter] string AssemblyVersion = "1.0.0.0";

[Parameter]
string InformationalVersion = "1.0.0.0";
[Parameter] string InformationalVersion = "1.0.0.0";

[Solution] readonly Solution Solution;
[GitRepository] readonly GitRepository GitRepository;
Expand Down Expand Up @@ -118,7 +111,7 @@

output.GlobFiles($"**/{item}*")
.Select(p => (Source: p, Target: mainOutput / output.GetRelativePathTo(p)))
.ForEach(t => CopyFile(t.Source, t.Target));

Check warning on line 114 in nukebuild/Build.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

'FileSystemTasks.CopyFile(AbsolutePath, AbsolutePath, FileExistsPolicy, bool)' is obsolete: 'Use AbsolutePath.Copy'

Check warning on line 114 in nukebuild/Build.cs

View workflow job for this annotation

GitHub Actions / build

'FileSystemTasks.CopyFile(AbsolutePath, AbsolutePath, FileExistsPolicy, bool)' is obsolete: 'Use AbsolutePath.Copy'
}

string[] asmsToCopy =
Expand All @@ -136,7 +129,7 @@
AbsolutePath output = OutputDirectory / asm;
output.GlobFiles($"**/{asm}.*")
.Select(p => (Source: p, Target: mainOutput / output.GetRelativePathTo(p)))
.ForEach(t => CopyFile(t.Source, t.Target));

Check warning on line 132 in nukebuild/Build.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

'FileSystemTasks.CopyFile(AbsolutePath, AbsolutePath, FileExistsPolicy, bool)' is obsolete: 'Use AbsolutePath.Copy'

Check warning on line 132 in nukebuild/Build.cs

View workflow job for this annotation

GitHub Actions / build

'FileSystemTasks.CopyFile(AbsolutePath, AbsolutePath, FileExistsPolicy, bool)' is obsolete: 'Use AbsolutePath.Copy'
}
}
});
Expand All @@ -155,9 +148,10 @@
fileName.Append('-');
fileName.Append(Runtime.ToString());
}

if (SelfContained && Runtime != null)
{
fileName.Append("-sc");
fileName.Append("-standalone");
}

fileName.Append('-');
Expand All @@ -177,6 +171,7 @@
.SetKeyValueDefinition("MyLicenseFile", RootDirectory / "LICENSE")
.SetKeyValueDefinition("MySetupIconFile", RootDirectory / "assets/logos/logo.ico")
.SetKeyValueDefinition("MySource", OutputDirectory / "Beutl")
.SetKeyValueDefinition("MyOutputBaseFilename", $"beutl{(SelfContained ? "-standalone" : "")}-setup")
.SetScriptFile(RootDirectory / "nukebuild/beutl-setup.iss"));
});

Expand Down
3 changes: 2 additions & 1 deletion nukebuild/beutl-setup.iss
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#define MyAppAssocName MyAppName + " Project File"
#define MyAppAssocExt ".bep"
#define MyAppAssocKey StringChange(MyAppAssocName, " ", "") + MyAppAssocExt
; #define MyOutputBaseFilename "beutl-setup"

[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
Expand All @@ -33,7 +34,7 @@ LicenseFile={#MyLicenseFile}
;PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
OutputDir={#MyOutputDir}
OutputBaseFilename=beutl-setup
OutputBaseFilename={#MyOutputBaseFilename}
SetupIconFile={#MySetupIconFile}
Compression=lzma
SolidCompression=yes
Expand Down
Loading