Compare commits
19 Commits
f5f1e1593b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| aed00324f6 | |||
| b329bc73e1 | |||
| cd8a9b0c76 | |||
| 4405bf4ab0 | |||
| f5acf8af4e | |||
| 6510314dea | |||
| ea5dc4d144 | |||
| 4ff826d9f4 | |||
| 769573a23b | |||
| d5632dea6e | |||
| 83efe0547e | |||
| 761d9086cd | |||
| 2214ae92d1 | |||
| a0147b8216 | |||
| e1d195f236 | |||
| 0fbea3d981 | |||
| 25e2c10bb2 | |||
| a296b509ae | |||
| 8b946e3423 |
45
.gitea/workflows/build.yaml
Normal file
45
.gitea/workflows/build.yaml
Normal file
@@ -0,0 +1,45 @@
|
||||
name: Build
|
||||
run-name: ${{ gitea.actor }} is building
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
steps:
|
||||
- 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=x86_64-linux-musl
|
||||
- run: ./zig-x86_64-linux-0.14.1/zig build -Doptimize=ReleaseSmall -Dtarget=x86_64-windows
|
||||
|
||||
|
||||
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/bin/
|
||||
|
||||
|
||||
|
||||
21
build.zig
21
build.zig
@@ -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, '-');
|
||||
|
||||
Reference in New Issue
Block a user