File tree Expand file tree Collapse file tree 4 files changed +31
-11
lines changed
Expand file tree Collapse file tree 4 files changed +31
-11
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
3- out_dir=" /tmp/zigcli-release/"
4- version=${RELEASE_VERSION:- unknown}
3+ OUT_DIR=${OUT_DIR:-/ tmp/ zigcli}
4+ VERSION=${RELEASE_VERSION:- unknown}
5+
6+ echo " Building zigcli ${VERSION} to ${OUT_DIR} ..."
57
68set -Eeuo pipefail
79trap cleanup SIGINT SIGTERM ERR EXIT
810cleanup () {
911 trap - SIGINT SIGTERM ERR EXIT
10- ls -ltrh " ${out_dir} "
11- rm -rf " ${out_dir} /*"
12+ ls -ltrh " ${OUT_DIR} "
1213}
1314
14- mkdir -p " ${out_dir } "
15+ mkdir -p " ${OUT_DIR } "
1516script_dir=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd -P)
1617
1718cd " ${script_dir} /.."
@@ -28,11 +29,23 @@ targets=(
2829export BUILD_DATE=$( date +' %Y-%m-%dT%H:%M:%S%z' )
2930export GIT_COMMIT=$( git rev-parse --short HEAD)
3031
32+ pandoc -f org -t markdown README.org -o README.md
33+
3134for target in " ${targets[@]} " ; do
3235 echo " Building for ${target} ..."
33- zig build -Doptimize=ReleaseSafe -Dtarget=" ${target} " \
36+ filename=zigcli-${VERSION} -${target}
37+ dst_dir=zig-out/${filename}
38+
39+ # 1. Build
40+ zig build -Doptimize=ReleaseSafe -Dtarget=" ${target} " -p ${dst_dir} \
3441 -Dgit_commit=${GIT_COMMIT} -Dbuild_date=${BUILD_DATE} -Dis_ci=true
42+
43+ # 2. Prepare files
44+ rm -f ${dst_dir} /bin/* demo
45+ cp LICENSE README.md ${dst_dir}
46+
47+ # 3. Zip final file
3548 pushd zig-out
36- zip -r zigcli- ${version} - ${target } .zip bin ../LICENSE ../README.org
49+ zip -r ${OUT_DIR} / ${filename } .zip " ${filename} "
3750 popd
3851done
Original file line number Diff line number Diff line change @@ -21,11 +21,16 @@ jobs:
2121 - name : Set env
2222 run : |
2323 echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
24+ echo "OUT_DIR=/tmp/zigcli-${{ github.ref_name }}" >> $GITHUB_ENV
25+ - name : Install
26+ uses : pandoc/actions/setup@v1
27+ with :
28+ version : 2.19
2429 - name : Build
2530 run : |
2631 bash .github/build-release.sh
2732 - name : Release
2833 uses : softprops/action-gh-release@v2
2934 if : startsWith(github.ref, 'refs/tags/')
3035 with :
31- files : /tmp/zigcli-release /*
36+ files : ${{ env.OUT_DIR }} /*
Original file line number Diff line number Diff line change 33/.zig-cache
44* lock
55docs /resources
6- docs /public
6+ docs /public
7+ README.md
Original file line number Diff line number Diff line change 11#+TITLE: Programs
22#+DATE: 2023-10-21T12:26:45+0800
3- #+LASTMOD: 2024-09-01T09:57:50 +0800
3+ #+LASTMOD: 2024-09-28T11:50:42 +0800
44#+TYPE: docs
55#+WEIGHT: 20
66#+DESCRIPTION: Binary programs which can be used directly
77
88* Install
9- Prebuilt binaries can be found in [[https://github.com/jiacai2050/zigcli/actions/workflows/binary.yml][CI's artifacts]], or you can build from source:
9+ Latest pre-built binaries can be downloaded on the [[https://github.com/jiacai2050/zigcli/releases][release page]], or you can build from source:
10+
1011#+begin_src bash
1112git clone https://github.com/jiacai2050/zigcli.git
1213#+end_src
You can’t perform that action at this time.
0 commit comments