-
-
Notifications
You must be signed in to change notification settings - Fork 5
77 lines (72 loc) · 2.07 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Release
on:
workflow_dispatch:
pull_request:
paths:
- "**.zig"
- ".github/workflows/CI.yml"
- ".github/workflows/release.yml"
push:
branches:
- main
paths:
- "**.zig"
- ".github/workflows/release.yml"
tags:
- "v*"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: write
jobs:
upload-assets:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: mlugg/setup-zig@v1
with:
version: 0.13.0
- name: Set env(release)
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(dev)
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: |
sudo apt update && sudo apt-get install -y libcurl4-openssl-dev
bash .github/build-release.sh
- name: Build(MacOS)
if: matrix.os == 'macos-latest'
run: |
mkdir -p "${OUT_DIR}"
zig build -Doptimize=ReleaseSafe \
-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
- name: Release
uses: softprops/action-gh-release@v2
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 }}