From f4676bab5ca0832390b74ef51a33ca75111a4ab1 Mon Sep 17 00:00:00 2001 From: jiacai2050 Date: Wed, 1 Jan 2025 18:44:15 +0800 Subject: [PATCH] fix upload --- .github/build-release.sh | 2 ++ .github/workflows/release.yml | 13 +++++++++++++ docs/content/_index.org | 31 +++++++++++++++++++++++++++++- docs/content/modules/_index.org | 21 +------------------- docs/content/programs/_index.org | 13 +------------ docs/content/programs/zigfetch.org | 18 +++++++++++++++++ src/bin/zigfetch.zig | 1 + 7 files changed, 66 insertions(+), 33 deletions(-) create mode 100644 docs/content/programs/zigfetch.org diff --git a/.github/build-release.sh b/.github/build-release.sh index b62bb0b..81ae258 100755 --- a/.github/build-release.sh +++ b/.github/build-release.sh @@ -47,6 +47,8 @@ for target in "${targets[@]}"; do rm -f ${dst_dir}/bin/*demo cp LICENSE README.org ${dst_dir} + find zig-out + # 3. Zip final file pushd zig-out zip -r ${OUT_DIR}/${filename}.zip "${filename}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5da7ed1..d812612 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -38,9 +38,15 @@ jobs: with: version: 0.13.0 - name: Set env + if: startsWith(github.ref, 'refs/tags/') run: | echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV echo "OUT_DIR=/tmp/zigcli" >> $GITHUB_ENV + - name: Set env + if: !startsWith(github.ref, 'refs/tags/') + run: | + echo "RELEASE_VERSION=unknown" >> $GITHUB_ENV + echo "OUT_DIR=/tmp/zigcli" >> $GITHUB_ENV - name: Build(Ubuntu) if: matrix.os == 'ubuntu-latest' run: | @@ -53,6 +59,7 @@ jobs: -Dgit_commit=${GIT_COMMIT} -Dbuild_date=${BUILD_DATE} rm -f zig-out/bin/*demo cp LICENSE README.org zig-out + find zig-out pushd zig-out zip -r ${OUT_DIR}/zigcli-${RELEASE_VERSION}-aarch64-macos.zip . popd @@ -61,3 +68,9 @@ jobs: if: startsWith(github.ref, 'refs/tags/') with: files: ${{ env.OUT_DIR }}/* + - name: Upload + if: !startsWith(github.ref, 'refs/tags/') + uses: actions/upload-artifact@v4 + with: + name: zigcli-${{ matrix.os }} + path: ${{ env.OUT_DIR }} diff --git a/docs/content/_index.org b/docs/content/_index.org index 9b88d04..2119b27 100644 --- a/docs/content/_index.org +++ b/docs/content/_index.org @@ -1,6 +1,6 @@ #+TITLE: Zigcli #+DATE: 2023-10-21T12:09:48+0800 -#+LASTMOD: 2025-01-01T17:52:56+0800 +#+LASTMOD: 2025-01-01T18:00:54+0800 #+TYPE: docs #+author: Jiacai Liu @@ -17,6 +17,35 @@ Official website: https://zigcli.liujiacai.net/ It can be imported as [[https://zigcli.liujiacai.net/modules/][Zig modules]] or used directly as [[https://zigcli.liujiacai.net/programs/][binary programs]]. +* Install +** Modules +=zigcli= support [[https://ziglang.org/download/0.11.0/release-notes.html#Package-Management][package manager]] introduced in Zig 0.11. + +#+begin_src bash +zig fetch --save=zigcli https://github.com/jiacai2050/zigcli/archive/${COMMIT}.tar.gz +#+end_src + +#+RESULTS: + +Replace ~${COMMIT}~ with a real one, then in your =build.zig=, import the module like this: + +#+begin_src zig +const zigcli = b.dependency("zigcli", .{}); + +// Currently zigcli provide two modules. +exe.root_module.addImport("simargs", zigcli.module("simargs")); +exe.root_module.addImport("pretty-table", zigcli.module("pretty-table")); +#+end_src +** Binary +Latest pre-built binaries can be downloaded on the [[https://github.com/jiacai2050/zigcli/releases][release page]], or you can build from source: + +#+begin_src bash +git clone https://github.com/jiacai2050/zigcli.git +#+end_src +Then build with +#+begin_src bash +make build +#+end_src * Who's Using If you're using =zigcli=, and would like to be added here, welcome to [[https://github.com/jiacai2050/zigcli/pulls][open a PR]]. diff --git a/docs/content/modules/_index.org b/docs/content/modules/_index.org index 1a518f8..06fd135 100644 --- a/docs/content/modules/_index.org +++ b/docs/content/modules/_index.org @@ -1,29 +1,10 @@ #+TITLE: Modules #+DATE: 2024-08-17T17:58:01+0800 -#+LASTMOD: 2024-08-17T18:17:19+0800 +#+LASTMOD: 2025-01-01T18:00:20+0800 #+WEIGHT: 10 #+TYPE: docs #+AUTHOR: Jiacai Liu #+DESCRIPTION: Zig modules -* Install -=zigcli= support [[https://ziglang.org/download/0.11.0/release-notes.html#Package-Management][package manager]] introduced in Zig 0.11. - -#+begin_src bash -zig fetch --save=zigcli https://github.com/jiacai2050/zigcli/archive/${COMMIT}.tar.gz -#+end_src - -#+RESULTS: - -Replace ~${COMMIT}~ with a real one, then in your =build.zig=, import the module like this: - -#+begin_src zig -const zigcli = b.dependency("zigcli", .{}); - -// Currently zigcli provide two modules. -exe.root_module.addImport("simargs", zigcli.module("simargs")); -exe.root_module.addImport("pretty-table", zigcli.module("pretty-table")); -#+end_src - * Available modules diff --git a/docs/content/programs/_index.org b/docs/content/programs/_index.org index 07c2270..87364fb 100644 --- a/docs/content/programs/_index.org +++ b/docs/content/programs/_index.org @@ -1,19 +1,8 @@ #+TITLE: Programs #+DATE: 2023-10-21T12:26:45+0800 -#+LASTMOD: 2024-09-28T11:50:42+0800 +#+LASTMOD: 2025-01-01T18:00:55+0800 #+TYPE: docs #+WEIGHT: 20 #+DESCRIPTION: Binary programs which can be used directly -* Install -Latest pre-built binaries can be downloaded on the [[https://github.com/jiacai2050/zigcli/releases][release page]], or you can build from source: - -#+begin_src bash -git clone https://github.com/jiacai2050/zigcli.git -#+end_src -Then build with -#+begin_src bash -make build -#+end_src - * Available Programs diff --git a/docs/content/programs/zigfetch.org b/docs/content/programs/zigfetch.org new file mode 100644 index 0000000..5504610 --- /dev/null +++ b/docs/content/programs/zigfetch.org @@ -0,0 +1,18 @@ +#+TITLE: zigfetch +#+DATE: 2025-01-01T18:01:47+0800 +#+LASTMOD: 2025-01-01T18:03:40+0800 +#+TYPE: docs +#+DESCRIPTION: Fetch zig package, baked by libcurl. + +#+begin_src bash :results verbatim :exports result :dir ../../.. +./zig-out/bin/zigfetch --help +#+end_src + +#+RESULTS: +: USAGE: +: ./zig-out/bin/zigfetch [OPTIONS] [--] [package-dir or url] +: +: OPTIONS: +: -h, --help Show help +: -v, --verbose Show verbose log +: -d, --debug-hash Print hash for each file diff --git a/src/bin/zigfetch.zig b/src/bin/zigfetch.zig index a1fe568..4bbcba4 100644 --- a/src/bin/zigfetch.zig +++ b/src/bin/zigfetch.zig @@ -29,6 +29,7 @@ const Args = struct { }; pub const __messages__ = .{ .@"debug-hash" = "Print hash for each file", + .verbose = "Show verbose log", .help = "Show help", }; };