Compare commits

..

11 Commits

Author SHA1 Message Date
1df9395324 add mise.toml
All checks were successful
Build / build (push) Successful in 22s
Build / x86_64-linux-gnu (push) Successful in 32s
Build / x86_64-windows (push) Successful in 21s
Build / x86_64-linux-musl (push) Successful in 21s
2026-01-19 19:42:19 +01:00
1062787e18 example for how to publish an artifact to gitea 2025-11-05 09:13:31 +01:00
dfc2a0668c build.sh automatically builds on changes 2025-11-05 09:10:49 +01:00
1cda4d05b3 add schema 2025-11-05 09:09:36 +01:00
aed00324f6 dang
All checks were successful
Build / x86_64-linux-gnu (push) Successful in 22s
Build / build (push) Successful in 26s
Build / x86_64-linux-musl (push) Successful in 22s
Build / x86_64-windows (push) Successful in 22s
2025-08-05 19:59:49 +02:00
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
5 changed files with 58 additions and 3 deletions

View File

@@ -1,10 +1,32 @@
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
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
@@ -14,9 +36,12 @@ jobs:
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
- run: ./zig-x86_64-linux-0.14.1/zig build -Doptimize=ReleaseSmall -Dtarget=x86_64-windows
- 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/

9
build.sh Executable file
View File

@@ -0,0 +1,9 @@
find src | entr -c sh -c 'echo "\n\n\n\n" ; zig build test 2>&1 | cat; echo "\n\n\n" ; date'
# build exe for windows
# doesn't work anymore, because I added the version number as module "config" to the
# root_module. In main,zig we import the module. This only works when building
# using the build.zig file, but not when building without a build file.
#zig build-exe src/main.zig -O ReleaseSmall -fstrip -fsingle-threaded -target x86_64-windows
zig build && ./zig-out/bin/zig-totp list

View File

@@ -124,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, '-');

2
mise.toml Normal file
View File

@@ -0,0 +1,2 @@
[tools]
zig = "0.14.1"

4
upload.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
curl --user andi:3fd33c5fdad991b34fcb33b77b68251dfeaf0b3f \
--upload-file zig-out/bin/zig-totp \
https://git.lucares.de/api/packages/andi/generic/zig-totp/0.0.1-1/zig-totp-0.0.1-1