Compare commits

..

18 Commits

Author SHA1 Message Date
b329bc73e1 add parser for pre_release version
Some checks failed
Build / x86_64-linux-gnu (push) Failing after 18s
Build / x86_64-linux-musl (push) Failing after 18s
Build / x86_64-windows (push) Failing after 18s
2025-08-02 12:45:53 +02:00
cd8a9b0c76 try upload-artifact@v3
Some checks failed
Build / x86_64-linux-gnu (push) Failing after 18s
Build / x86_64-linux-musl (push) Failing after 18s
Build / x86_64-windows (push) Failing after 18s
2025-08-02 12:34:32 +02:00
4405bf4ab0 try caching
All checks were successful
Build / build (push) Successful in 22s
Build / x86_64-linux-gnu (push) Successful in 54s
Build / x86_64-linux-musl (push) Successful in 54s
Build / x86_64-windows (push) Successful in 53s
2025-08-02 12:28:08 +02:00
f5acf8af4e use target zig understands
All checks were successful
Build / x86_64-linux-gnu (push) Successful in 26s
Build / x86_64-linux-musl (push) Successful in 24s
Build / x86_64-windows (push) Successful in 23s
Build / build (push) Successful in 30s
2025-08-02 10:44:50 +02:00
6510314dea forgot the target
Some checks failed
Build / build (push) Successful in 21s
Build / x86_64-unknown-linux-musl (push) Failing after 15s
Build / x86_64-windows (push) Successful in 19s
2025-08-02 10:37:01 +02:00
ea5dc4d144 try matrix build
Some checks failed
Build / build (push) Successful in 21s
Build / x86_64-unknown-linux-musl (push) Failing after 15s
Build / x86_64-windows (push) Failing after 15s
2025-08-02 10:34:54 +02:00
4ff826d9f4 fetch complete repo
Some checks failed
Build / build (push) Failing after 1m10s
2025-07-28 19:03:08 +02:00
769573a23b try to upload artifacts
Some checks failed
Build / build (push) Failing after 32s
2025-07-28 18:55:50 +02:00
d5632dea6e fetch tags
All checks were successful
Build / build (push) Successful in 22s
2025-07-28 18:49:40 +02:00
83efe0547e cross compile for windows and linux
All checks were successful
Build / build (push) Successful in 23s
2025-07-28 18:46:41 +02:00
761d9086cd moving the zig binary doesn't work
Some checks failed
Build / build (push) Failing after 21s
2025-07-27 17:58:24 +02:00
2214ae92d1 I am so stupid
Some checks failed
Build / build (push) Failing after 8s
2025-07-27 17:56:39 +02:00
a0147b8216 host.docker.internal doesn't work, try magic ip instead
Some checks failed
Build / build (push) Failing after 8s
2025-07-27 17:55:40 +02:00
e1d195f236 brainfart
Some checks failed
Build / build (push) Failing after 5s
2025-07-27 17:54:53 +02:00
0fbea3d981 cannot use localhost in a container, obviously
Some checks failed
Build / build (push) Failing after 5s
2025-07-27 17:51:51 +02:00
25e2c10bb2 ubuntu slim does not have wget or curl
Some checks failed
Build / build (push) Failing after 5s
2025-07-27 17:50:33 +02:00
a296b509ae typo in name for checkout action
Some checks failed
Build / build (push) Failing after 13s
2025-07-27 17:46:56 +02:00
8b946e3423 1st try of a build workflow
Some checks failed
Build / build (push) Failing after 19s
2025-07-27 17:45:03 +02:00
2 changed files with 53 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
name: Build
run-name: ${{ gitea.actor }} is building
on: [push]
jobs:
release:
name: ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-linux-musl
- target: x86_64-linux-gnu
- target: x86_64-windows
steps:
- run: printenv
- name: Check out repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: ''
- run: wget http://172.17.0.1:8081/repository/ziglang.org/download/0.14.1/zig-x86_64-linux-0.14.1.tar.xz
- run: tar xfv zig-x86_64-linux-0.14.1.tar.xz
- run: ./zig-x86_64-linux-0.14.1/zig build -Doptimize=ReleaseSmall -Dtarget=${{ matrix.target }} -Dexe_name=zig-totp-$GITHUB_REF_NAME-${{ matrix.target }}
- name: upload artifacts
uses: actions/upload-artifact@v3
with:
name: zig-totp-${{matrix.target }}
path: zig-out

View File

@@ -22,8 +22,10 @@ pub fn build(b: *std.Build) void {
// set a preferred release mode, allowing the user to decide how to optimize.
const optimize = b.standardOptimizeOption(.{});
const exe_name = b.option([]const u8, "exe_name", "Name of the executable") orelse "zig-totp";
const lib = b.addStaticLibrary(.{
.name = "zig-totp",
.name = exe_name,
// In this case the main source file is merely a path, however, in more
// complicated build scripts, this could be a generated file.
.root_source_file = b.path("src/root.zig"),
@@ -37,7 +39,7 @@ pub fn build(b: *std.Build) void {
b.installArtifact(lib);
const exe = b.addExecutable(.{
.name = "zig-totp",
.name = exe_name,
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
@@ -122,6 +124,21 @@ fn getVersion(b: *std.Build) std.SemanticVersion {
}
return totp_version;
},
1 => {
// prerelease version: 1.0.0-dev
var iter = std.mem.splitScalar(u8, output_trimmed, '-');
const tag = iter.first();
const pre_release = iter.next().?;
const v: std.SemanticVersion = std.SemanticVersion.parse(tag) catch unreachable;
return .{
.major = v.major,
.minor = v.minor,
.patch = v.patch,
.pre = b.fmt("{s}", .{pre_release}),
};
},
2 => {
// development version, e.g. 1.0.0-7-64es356
var iter = std.mem.splitScalar(u8, output_trimmed, '-');