Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
with:
ref: ${{ inputs.release_tag }}
- uses: Ledger-Donjon/absolution/.github/actions/setup-zig@main
- run: zig build -Doptimize=${{ matrix.optimize }} -Dstrip=true
- run: zig build -Doptimize=${{ matrix.optimize }} -Dstrip=true -Dversion="${RELEASE_TAG}"
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RELEASE_TAG is not defined in this workflow step (no env: assignment shown), so -Dversion will likely be empty at build time. Use the GitHub expression directly (e.g., -Dversion="${{ inputs.release_tag }}") or define env: RELEASE_TAG: ${{ inputs.release_tag }} for the step/job.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is defined at the workflow level no ?

- name: Upload tarball
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f #v7.0.0
with:
Expand Down
9 changes: 9 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const strip = b.option(bool, "strip", "Strip debug info from the binary");
const version_str = b.option(
[]const u8,
"version",
"Version string embedded in the binary (shown in --help)",
) orelse "dev";

const build_options = b.addOptions();
build_options.addOption([]const u8, "version", version_str);

const aro_dep = b.dependency("aro", .{
.target = target,
Expand Down Expand Up @@ -36,6 +44,7 @@ pub fn build(b: *std.Build) void {
},
}),
});
exe.root_module.addOptions("build_options", build_options);

b.installArtifact(exe);
install_zig_cc_sysroot_headers(b);
Expand Down
11 changes: 10 additions & 1 deletion src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
const builtin = @import("builtin");
const std = @import("std");
const clap = @import("clap");
const build_options = @import("build_options");
const absolution = @import("absolution");
const Invariant = absolution.Invariant;
const Global = absolution.Parser.Global;
Expand Down Expand Up @@ -107,10 +108,18 @@ const help_opts: clap.HelpOptions = .{
};

fn printHelpAndFail(stream: std.fs.File) !Options {
try clap.helpToFile(stream, clap.Help, &cli, help_opts);
try printHelp(stream);
return error.InvalidArgs;
}

fn printHelp(stream: std.fs.File) !void {
var banner_buf: [256]u8 = undefined;
var w = stream.writer(&banner_buf);
try w.interface.print("absolution @{s}\n\n", .{build_options.version});
try w.interface.flush();
Comment thread
0pendev marked this conversation as resolved.
try clap.helpToFile(stream, clap.Help, &cli, help_opts);
}

fn parseArgs(allocator: std.mem.Allocator) !Options {
var diag = clap.Diagnostic{};
var res = clap.parse(clap.Help, &cli, clap.parsers.default, .{
Expand Down