-
Notifications
You must be signed in to change notification settings - Fork 3
153 lines (131 loc) · 4.56 KB
/
Copy pathrelease.yml
File metadata and controls
153 lines (131 loc) · 4.56 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
name: Release
on:
workflow_run:
workflows: ["CI"]
types: [completed]
branches: [master]
workflow_dispatch:
permissions:
contents: write
env:
ZIG_VERSION: 0.15.2
jobs:
build-linux-x86_64:
name: Build (Linux x86_64)
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
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 i ${{ 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-22 main"
sudo apt-get update
sudo apt-get install -y llvm-22-dev clang-22 libclang-22-dev
echo "/usr/lib/llvm-22/bin" >> $GITHUB_PATH
- name: Build Release
run: zig build -Doptimize=ReleaseFast
- name: Package
run: |
mkdir -p dist
cp zig-out/bin/OmniScope dist/OmniScope-linux-x86_64
chmod +x dist/OmniScope-linux-x86_64
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: OmniScope-linux-x86_64
path: dist/OmniScope-linux-x86_64
retention-days: 5
build-macos-aarch64:
name: Build (macOS aarch64)
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
runs-on: macos-latest
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@22 && echo "$(brew --prefix llvm@22)/bin" >> $GITHUB_PATH
- name: Build Release
run: zig build -Doptimize=ReleaseFast
- name: Package
run: |
mkdir -p dist
cp zig-out/bin/OmniScope dist/OmniScope-macos-aarch64
chmod +x dist/OmniScope-macos-aarch64
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: OmniScope-macos-aarch64
path: dist/OmniScope-macos-aarch64
retention-days: 5
release:
name: Create Release
needs: [build-linux-x86_64, build-macos-aarch64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Read version
id: version
run: |
VERSION=$(cat VERSION)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
- name: Read Release Notes
id: changelog
run: |
if [ -f RELEASE_NOTES.md ]; then
cp RELEASE_NOTES.md /tmp/release_body.md
echo "Using RELEASE_NOTES.md for release notes"
else
VERSION=$(cat VERSION)
CHANGELOG=$(awk "
/^## .*\[.*${VERSION}.*\]/ { found=1; next }
found && /^## .*\[/ { exit }
found { print }
" CHANGELOG.md)
if [ -z "$CHANGELOG" ]; then
CHANGELOG=$(cat CHANGELOG.md)
fi
echo "$CHANGELOG" > /tmp/release_body.md
echo "Falling back to CHANGELOG.md"
fi
- name: Download Linux x86_64 binary
uses: actions/download-artifact@v4
with:
name: OmniScope-linux-x86_64
path: dist
- name: Download macOS aarch64 binary
uses: actions/download-artifact@v4
with:
name: OmniScope-macos-aarch64
path: dist
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: OmniScope ${{ steps.version.outputs.tag }}
body_path: /tmp/release_body.md
draft: false
prerelease: false
files: |
dist/OmniScope-linux-x86_64
dist/OmniScope-macos-aarch64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}