Skip to content

Commit

Permalink
fix upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jiacai2050 committed Jan 1, 2025
1 parent 3dd03fe commit f4676ba
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .github/build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand All @@ -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 }}
31 changes: 30 additions & 1 deletion docs/content/_index.org
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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]].

Expand Down
21 changes: 1 addition & 20 deletions docs/content/modules/_index.org
Original file line number Diff line number Diff line change
@@ -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
13 changes: 1 addition & 12 deletions docs/content/programs/_index.org
Original file line number Diff line number Diff line change
@@ -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
18 changes: 18 additions & 0 deletions docs/content/programs/zigfetch.org
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions src/bin/zigfetch.zig
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const Args = struct {
};
pub const __messages__ = .{
.@"debug-hash" = "Print hash for each file",
.verbose = "Show verbose log",
.help = "Show help",
};
};
Expand Down

0 comments on commit f4676ba

Please sign in to comment.