Skip to content

Commit f796888

Browse files
authored
feat: add GitHub release creation to deployment workflow (#237)
The deployment workflow was publishing NuGet packages but not creating GitHub releases with platform-specific executables. This prevented the proto plugin from downloading Morphir executables. Changes: **Build Targets:** - Add PackPlatformTarballs target (Build.Packaging.cs) - Creates tarballs from single-file executables in correct format - Format: morphir-{rid}-v{version}.tar.gz - Required by proto plugin for executable downloads - Add CreateGitHubRelease target (Build.Publishing.cs) - Creates GitHub release with platform tarballs as assets - Generates release notes with installation instructions - Includes proto plugin installation guide - Respects skip-git-release parameter **Workflow:** - Add CreateGitHubRelease step after NuGet publishing - Conditionally runs based on skip-git-release parameter - Uses Nuke targets for consistency with build system **Impact:** - Future Morphir releases will have GitHub releases with executables - Proto plugin can now download and install Morphir executables - Enables proto-based installation: `proto install morphir` Fixes the missing GitHub release issue preventing proto plugin from working with Morphir releases. 🤖 Generated with Claude Code
1 parent 11b8ef2 commit f796888

File tree

3 files changed

+175
-0
lines changed

3 files changed

+175
-0
lines changed

.github/workflows/deployment.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ jobs:
160160
- name: Publish packages to NuGet
161161
run: ./build.sh --target PublishAll --api-key ${{ env.NUGET_TOKEN }} --nuget-source https://api.nuget.org/v3/index.json
162162

163+
- name: Create GitHub Release
164+
if: ${{ env.SKIP_GIT_RELEASE != 'true' }}
165+
run: ./build.sh --target CreateGitHubRelease --version ${{ env.RELEASE_VERSION }}
166+
163167
cd:
164168
runs-on: ubuntu-latest
165169
needs: [validate-release-version, release]

build/Build.Packaging.cs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
using System;
2+
using System.IO;
23
using System.Linq;
4+
using System.Runtime.InteropServices;
35
using Nuke.Common;
46
using Nuke.Common.IO;
57
using Nuke.Common.Tools.DotNet;
@@ -91,4 +93,65 @@ partial class Build
9193
{
9294
Serilog.Log.Information("All packages created successfully");
9395
});
96+
97+
/// <summary>
98+
/// Create platform-specific tarballs from single-file executables
99+
/// Input: artifacts/single-file/{rid}/morphir[.exe]
100+
/// Output: artifacts/morphir-{rid}-v{version}.tar.gz
101+
/// Used by deployment workflow to create GitHub release assets
102+
/// </summary>
103+
Target PackPlatformTarballs => _ => _
104+
.Description("Create platform-specific tarballs for GitHub releases")
105+
.Executes(() =>
106+
{
107+
var singleFileDir = RootDirectory / "artifacts" / "single-file";
108+
var artifactsDir = RootDirectory / "artifacts";
109+
110+
if (!Directory.Exists(singleFileDir))
111+
{
112+
throw new Exception($"Single-file directory not found: {singleFileDir}. Run build-executables job first.");
113+
}
114+
115+
var versionString = Version.ToString();
116+
Serilog.Log.Information($"Creating platform tarballs for version {versionString}...");
117+
118+
// Find all RID directories
119+
var ridDirs = Directory.GetDirectories(singleFileDir)
120+
.Select(d => new DirectoryInfo(d).Name)
121+
.Where(name => !name.Equals("staging", StringComparison.OrdinalIgnoreCase))
122+
.ToList();
123+
124+
if (!ridDirs.Any())
125+
{
126+
throw new Exception($"No RID directories found in {singleFileDir}");
127+
}
128+
129+
foreach (var rid in ridDirs)
130+
{
131+
var ridDir = singleFileDir / rid;
132+
var tarballName = $"morphir-{rid}-v{versionString}.tar.gz";
133+
var tarballPath = artifactsDir / tarballName;
134+
135+
Serilog.Log.Information($"Creating tarball for {rid}...");
136+
137+
// Create tarball using cross-platform tar
138+
var tarExitCode = RunCommand(
139+
"tar",
140+
"-czf",
141+
tarballPath,
142+
"-C", ridDir,
143+
"."
144+
);
145+
146+
if (tarExitCode != 0)
147+
{
148+
throw new Exception($"Failed to create tarball for {rid} (exit code: {tarExitCode})");
149+
}
150+
151+
var size = GetFileSize(tarballPath);
152+
Serilog.Log.Information($"✓ Created {tarballName} ({size})");
153+
}
154+
155+
Serilog.Log.Information($"✓ All platform tarballs created successfully");
156+
});
94157
}

build/Build.Publishing.cs

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.IO;
23
using System.Linq;
34
using Nuke.Common;
45
using Nuke.Common.IO;
@@ -295,4 +296,111 @@ partial class Build
295296
Serilog.Log.Information($" 5. After merge, tag: git tag -a v{ReleaseVersion} -m \"Release {ReleaseVersion}\"");
296297
Serilog.Log.Information($" 6. Push tag: git push origin v{ReleaseVersion}");
297298
});
299+
300+
/// <summary>
301+
/// Create a GitHub release with platform-specific executable tarballs
302+
/// Requires: Platform tarballs created by PackPlatformTarballs target
303+
/// Input: artifacts/morphir-{rid}-v{version}.tar.gz
304+
/// Output: GitHub release at https://github.com/finos/morphir-dotnet/releases/tag/v{version}
305+
/// Parameters: --version (required)
306+
/// </summary>
307+
Target CreateGitHubRelease => _ => _
308+
.DependsOn(PackPlatformTarballs)
309+
.Description("Create a GitHub release with platform-specific executables")
310+
.Executes(() =>
311+
{
312+
var versionString = Version.ToString();
313+
var releaseTag = $"v{versionString}";
314+
var artifactsDir = RootDirectory / "artifacts";
315+
316+
Serilog.Log.Information($"Creating GitHub release for {releaseTag}...");
317+
318+
// Find all platform tarballs
319+
var tarballs = Directory.GetFiles(artifactsDir, $"morphir-*-v{versionString}.tar.gz")
320+
.ToList();
321+
322+
if (!tarballs.Any())
323+
{
324+
throw new Exception($"No platform tarballs found in {artifactsDir}. Run PackPlatformTarballs first.");
325+
}
326+
327+
Serilog.Log.Information($"Found {tarballs.Count} platform tarballs");
328+
329+
// Create release notes file
330+
var releaseNotesPath = artifactsDir / "release-notes.md";
331+
var releaseNotes = $@"# Morphir .NET v{versionString}
332+
333+
Platform-specific executables for the Morphir CLI.
334+
335+
## Installation
336+
337+
### Using proto (recommended)
338+
339+
```bash
340+
# Install proto plugin
341+
proto plugin add morphir ""source:https://github.com/finos/morphir-dotnet/releases/download/plugin-v0.1.0/morphir_plugin.wasm""
342+
343+
# Install Morphir
344+
proto install morphir {versionString}
345+
```
346+
347+
### Manual installation
348+
349+
Download the appropriate tarball for your platform and extract it:
350+
351+
```bash
352+
# Linux x64
353+
wget https://github.com/finos/morphir-dotnet/releases/download/v{versionString}/morphir-linux-x64-v{versionString}.tar.gz
354+
tar -xzf morphir-linux-x64-v{versionString}.tar.gz
355+
356+
# macOS ARM64 (Apple Silicon)
357+
wget https://github.com/finos/morphir-dotnet/releases/download/v{versionString}/morphir-osx-arm64-v{versionString}.tar.gz
358+
tar -xzf morphir-osx-arm64-v{versionString}.tar.gz
359+
360+
# Windows x64
361+
wget https://github.com/finos/morphir-dotnet/releases/download/v{versionString}/morphir-win-x64-v{versionString}.tar.gz
362+
tar -xzf morphir-win-x64-v{versionString}.tar.gz
363+
```
364+
365+
## Supported Platforms
366+
367+
- Linux (x64, arm64)
368+
- macOS (x64, arm64/Apple Silicon)
369+
- Windows (x64)
370+
371+
## NuGet Packages
372+
373+
This release is also available on NuGet:
374+
- [Morphir](https://www.nuget.org/packages/Morphir/{versionString}) - CLI tool
375+
- [Morphir.Core](https://www.nuget.org/packages/Morphir.Core/{versionString}) - Core library
376+
- [dotnet-morphir](https://www.nuget.org/packages/dotnet-morphir/{versionString}) - .NET global tool
377+
378+
## Resources
379+
380+
- [Morphir Documentation](https://morphir.finos.org/)
381+
- [GitHub Repository](https://github.com/finos/morphir-dotnet)
382+
- [FINOS Morphir](https://github.com/finos/morphir)
383+
";
384+
385+
File.WriteAllText(releaseNotesPath, releaseNotes);
386+
Serilog.Log.Information($"✓ Created release notes: {releaseNotesPath}");
387+
388+
// Build gh release create command with all tarballs
389+
var tarballArgs = string.Join(" ", tarballs.Select(t => $"\"{t}\""));
390+
var ghCommand = $"release create \"{releaseTag}\" " +
391+
$"--title \"Morphir .NET v{versionString}\" " +
392+
$"--notes-file \"{releaseNotesPath}\" " +
393+
tarballArgs;
394+
395+
Serilog.Log.Information("Creating GitHub release...");
396+
var exitCode = RunCommand("gh", ghCommand.Split(' '));
397+
398+
if (exitCode != 0)
399+
{
400+
throw new Exception($"Failed to create GitHub release (exit code: {exitCode})");
401+
}
402+
403+
Serilog.Log.Information($"✓ GitHub release created successfully");
404+
Serilog.Log.Information($" View at: https://github.com/finos/morphir-dotnet/releases/tag/{releaseTag}");
405+
});
298406
}

0 commit comments

Comments
 (0)