-
Notifications
You must be signed in to change notification settings - Fork 3
189 lines (179 loc) · 6.62 KB
/
Copy pathrelease.yml
File metadata and controls
189 lines (179 loc) · 6.62 KB
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: Release
on:
push:
branches: [master]
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.2.0)'
required: false
permissions:
contents: write
env:
ZIG_VERSION: 0.15.2
jobs:
get-version:
name: Get Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- uses: actions/checkout@v4
- name: Determine version
id: version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ] && [ -n "${{ inputs.version }}" ]; then
VERSION="${{ inputs.version }}"
elif [[ "${{ github.ref }}" == refs/tags/v* ]]; then
VERSION="${GITHUB_REF#refs/tags/v}"
else
VERSION=$(cat VERSION 2>/dev/null || echo "0.2.0")
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
build-linux:
name: Build Linux
runs-on: ubuntu-latest
needs: [get-version]
steps:
- uses: actions/checkout@v4
- name: Install ZVM and Zig
run: |
curl -sSL https://www.zvm.app/install.sh | bash
export ZVM_INSTALL="$HOME/.zvm/self"
export PATH="$HOME/.zvm/bin:$ZVM_INSTALL:$PATH"
zvm install ${{ env.ZIG_VERSION }}
zvm use ${{ env.ZIG_VERSION }}
echo "$HOME/.zvm/bin" >> $GITHUB_PATH
echo "$HOME/.zvm/self" >> $GITHUB_PATH
- name: Install LLVM
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository -y "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main"
sudo apt-get update
sudo apt-get install -y llvm-21-dev clang-21 libclang-21-dev
- name: Build
run: zig build -Doptimize=ReleaseFast
- name: Package
run: |
mkdir -p dist
cp zig-out/bin/OmniScope dist/OmniScope-${{ needs.get-version.outputs.version }}-linux-x86_64
cd dist && tar -czvf OmniScope-${{ needs.get-version.outputs.version }}-linux-x86_64.tar.gz OmniScope-${{ needs.get-version.outputs.version }}-linux-x86_64
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: linux-binary
path: dist/*.tar.gz
build-macos:
name: Build macOS
runs-on: macos-latest
needs: [get-version]
steps:
- uses: actions/checkout@v4
- name: Install ZVM and Zig
run: |
curl -sSL https://www.zvm.app/install.sh | bash
export ZVM_INSTALL="$HOME/.zvm/self"
export PATH="$HOME/.zvm/bin:$ZVM_INSTALL:$PATH"
zvm install ${{ env.ZIG_VERSION }}
zvm use ${{ env.ZIG_VERSION }}
echo "$HOME/.zvm/bin" >> $GITHUB_PATH
echo "$HOME/.zvm/self" >> $GITHUB_PATH
- name: Install LLVM and dependencies
run: brew install llvm@21 zlib
- name: Build
run: |
export LDFLAGS="-L/opt/homebrew/lib -lz"
export LIBRARY_PATH="/opt/homebrew/lib"
zig build -Doptimize=ReleaseFast
- name: Package
run: |
mkdir -p dist
cp zig-out/bin/OmniScope dist/OmniScope-${{ needs.get-version.outputs.version }}-macos-x86_64
cd dist && tar -czvf OmniScope-${{ needs.get-version.outputs.version }}-macos-x86_64.tar.gz OmniScope-${{ needs.get-version.outputs.version }}-macos-x86_64
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macos-binary
path: dist/*.tar.gz
build-macos-arm:
name: Build macOS ARM
runs-on: macos-14
needs: [get-version]
steps:
- uses: actions/checkout@v4
- name: Install ZVM and Zig
run: |
curl -sSL https://www.zvm.app/install.sh | bash
export ZVM_INSTALL="$HOME/.zvm/self"
export PATH="$HOME/.zvm/bin:$ZVM_INSTALL:$PATH"
zvm install ${{ env.ZIG_VERSION }}
zvm use ${{ env.ZIG_VERSION }}
echo "$HOME/.zvm/bin" >> $GITHUB_PATH
echo "$HOME/.zvm/self" >> $GITHUB_PATH
- name: Install LLVM
run: brew install llvm
- name: Build
run: |
export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/llvm/lib"
export CPPFLAGS="-I/opt/homebrew/opt/llvm/include"
zig build -Doptimize=ReleaseFast -Dtarget=aarch64-macos
- name: Package
run: |
mkdir -p dist
cp zig-out/bin/OmniScope dist/OmniScope-${{ needs.get-version.outputs.version }}-macos-aarch64
cd dist && tar -czvf OmniScope-${{ needs.get-version.outputs.version }}-macos-aarch64.tar.gz OmniScope-${{ needs.get-version.outputs.version }}-macos-aarch64
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: macos-arm-binary
path: dist/*.tar.gz
create-release:
name: Create Release
runs-on: ubuntu-latest
needs: [get-version, build-linux, build-macos, build-macos-arm]
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: dist
- name: Prepare release assets
run: |
mkdir -p release-assets
find dist -name "*.tar.gz" -exec cp {} release-assets/ \;
- name: Generate checksums
run: |
cd release-assets
sha256sum *.tar.gz > checksums.sha256
- name: Extract changelog for version
id: changelog
run: |
VERSION="${{ needs.get-version.outputs.version }}"
# Extract changelog section for this version
CHANGELOG_CONTENT=$(awk -v ver="$VERSION" '
/^## \[/ { in_section=0 }
/^## \['"$ver"'\]/ { in_section=1; next }
in_section { print }
' CHANGELOG.md | sed 's/^#*/#/g' | head -50)
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG_CONTENT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.get-version.outputs.tag }}
name: OmniScope ${{ needs.get-version.outputs.tag }}
body: |
## OmniScope ${{ needs.get-version.outputs.version }}
${{ steps.changelog.outputs.content }}
See [CHANGELOG.md](CHANGELOG.md) for full history.
files: release-assets/*
draft: false
prerelease: ${{ contains(needs.get-version.outputs.version, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}