File tree Expand file tree Collapse file tree 4 files changed +32
-11
lines changed Expand file tree Collapse file tree 4 files changed +32
-11
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
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} ..."
5
7
6
8
set -Eeuo pipefail
7
9
trap cleanup SIGINT SIGTERM ERR EXIT
8
10
cleanup () {
9
11
trap - SIGINT SIGTERM ERR EXIT
10
- ls -ltrh " ${out_dir } "
11
- rm -rf " ${out_dir} /* "
12
+ ls -ltrh " ${OUT_DIR } "
13
+ rm -rf " ${OUT_DIR} "
12
14
}
13
15
14
- mkdir -p " ${out_dir } "
16
+ mkdir -p " ${OUT_DIR } "
15
17
script_dir=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd -P)
16
18
17
19
cd " ${script_dir} /.."
@@ -28,11 +30,23 @@ targets=(
28
30
export BUILD_DATE=$( date +' %Y-%m-%dT%H:%M:%S%z' )
29
31
export GIT_COMMIT=$( git rev-parse --short HEAD)
30
32
33
+ pandoc -f org -t markdown README.org -o README.md
34
+
31
35
for target in " ${targets[@]} " ; do
32
36
echo " Building for ${target} ..."
33
- zig build -Doptimize=ReleaseSafe -Dtarget=" ${target} " \
37
+ filename=zigcli-${VERSION} -${target}
38
+ dst_dir=zig-out/${filename}
39
+
40
+ # 1. Build
41
+ zig build -Doptimize=ReleaseSafe -Dtarget=" ${target} " -p ${dst_dir} \
34
42
-Dgit_commit=${GIT_COMMIT} -Dbuild_date=${BUILD_DATE} -Dis_ci=true
43
+
44
+ # 2. Prepare files
45
+ rm -f ${dst_dir} /bin/* demo
46
+ cp LICENSE README.md ${dst_dir}
47
+
48
+ # 3. Zip final file
35
49
pushd zig-out
36
- zip -r zigcli- ${version} - ${target } .zip bin ../LICENSE ../README.org
50
+ zip -r ${OUT_DIR} / ${filename } .zip " ${filename} "
37
51
popd
38
52
done
Original file line number Diff line number Diff line change @@ -21,11 +21,16 @@ jobs:
21
21
- name : Set env
22
22
run : |
23
23
echo "RELEASE_VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
24
+ echo "OUT_DIR=/tmp/zigcli-release" >> $GITHUB_ENV
25
+ - name : Install
26
+ uses : pandoc/actions/setup@v1
27
+ with :
28
+ version : 2.19
24
29
- name : Build
25
30
run : |
26
31
bash .github/build-release.sh
27
32
- name : Release
28
33
uses : softprops/action-gh-release@v2
29
34
if : startsWith(github.ref, 'refs/tags/')
30
35
with :
31
- files : /tmp/zigcli-release /*
36
+ files : ${{ env.OUT_DIR }} /*
Original file line number Diff line number Diff line change 3
3
/.zig-cache
4
4
* lock
5
5
docs /resources
6
- docs /public
6
+ docs /public
7
+ README.md
Original file line number Diff line number Diff line change 1
1
#+TITLE: Programs
2
2
#+DATE: 2023-10-21T12:26:45+0800
3
- #+LASTMOD: 2024-09-01T09:57:50 +0800
3
+ #+LASTMOD: 2024-09-28T11:50:42 +0800
4
4
#+TYPE: docs
5
5
#+WEIGHT: 20
6
6
#+DESCRIPTION: Binary programs which can be used directly
7
7
8
8
* 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
+
10
11
#+begin_src bash
11
12
git clone https://github.com/jiacai2050/zigcli.git
12
13
#+end_src
You can’t perform that action at this time.
0 commit comments