-
Notifications
You must be signed in to change notification settings - Fork 1
196 lines (185 loc) · 6.35 KB
/
build-binary.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
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
190
191
192
193
194
195
196
name: Build phantomake binary
on:
push:
tags:
- '*'
jobs:
build-binary-linux:
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
working-directory: ./packages/phantomake/
steps:
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Check out repository code
uses: actions/checkout@v4
- name: Bun install
run: |
bun install
- name: Build phantomake
run: |
bun run build
chmod +x phantomake
tar -zcvf phantomake-linux.tar.gz phantomake
- uses: actions/upload-artifact@v4
with:
name: phantomake-linux
path: ./packages/phantomake/phantomake
- name: Upload binary to release
uses: softprops/action-gh-release@v1
with:
files: ./packages/phantomake/phantomake-linux.tar.gz
build-binary-macos:
runs-on: macos-latest
permissions:
contents: write
defaults:
run:
working-directory: ./packages/phantomake/
steps:
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Check out repository code
uses: actions/checkout@v4
- name: Bun install
run: |
bun install
- name: Build phantomake
run: |
# Manually call compile because we need to make a universal binary
rm -rf node_modules/fsevents
bun build src/cli.ts --compile --minify --target=bun-darwin-arm64 --outfile=phantomake-arm64
bun build src/cli.ts --compile --minify --target=bun-darwin-x64 --outfile=phantomake-x64
lipo -create -output phantomake phantomake-arm64 phantomake-x64
chmod +x phantomake
tar -zcvf phantomake-macos.tar.gz phantomake
- uses: actions/upload-artifact@v4
with:
name: phantomake-macos
path: ./packages/phantomake/phantomake
- name: Upload binary to release
uses: softprops/action-gh-release@v1
with:
files: ./packages/phantomake/phantomake-macos.tar.gz
build-binary-windows:
runs-on: windows-latest
permissions:
contents: write
defaults:
run:
working-directory: ./packages/phantomake/
steps:
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Check out repository code
uses: actions/checkout@v4
- name: Bun install
run: |
bun install
- name: Build phantomake (Windows)
run: |
bun run build
Compress-Archive -Path phantomake.exe -Destination phantomake-windows.zip
- uses: actions/upload-artifact@v4
with:
name: phantomake-windows.exe
path: ./packages/phantomake/phantomake.exe
- name: Upload binary to release
uses: softprops/action-gh-release@v1
with:
files: ./packages/phantomake/phantomake-windows.zip
upload-source:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Make source tarball
run: |
git archive --format=tar.gz -o source.tar.gz --prefix=phantomake/ HEAD
- name: Upload tarball to release
uses: softprops/action-gh-release@v1
with:
files: source.tar.gz
publish-tauri:
needs: [build-binary-linux, build-binary-macos, build-binary-windows]
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest'
args: '--target universal-apple-darwin'
artifact-name: phantomake-macos
- platform: 'ubuntu-latest'
args: ''
artifact-name: phantomake-linux
- platform: 'windows-latest'
args: ''
artifact-name: phantomake-windows.exe
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- name: Setup bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './packages/gui/src-tauri -> target'
- name: install frontend dependencies
working-directory: ./packages/gui/
run: bun install
- name: Download binary artifact
uses: actions/download-artifact@v4
with:
name: ${{ matrix.artifact-name }}
- name: Copy Phantomake binary to tauri bin dir (Unix)
if: matrix.platform == 'ubuntu-latest'
run: |
mv phantomake ./packages/gui/src-tauri/bin/phantomake-$(rustc -Vv | grep host | cut -f2 -d' ')
- name: Copy Phantomake binary to tauri bin dir (MacOS)
if: matrix.platform == 'macos-latest'
run: |
mv phantomake ./packages/gui/src-tauri/bin/phantomake-universal-apple-darwin
cd ./packages/gui/src-tauri/bin
ln -s phantomake-universal-apple-darwin phantomake-aarch64-apple-darwin
ln -s phantomake-universal-apple-darwin phantomake-x86_64-apple-darwin
pwd
ls -l .
- name: Copy Phantomake binary to tauri bin dir (Windows)
if: matrix.platform == 'windows-latest'
run: |
Move-Item -Path phantomake.exe -Destination .\packages\gui\src-tauri\bin\phantomake-$(rustc -Vv | Select-String "host:" | ForEach-Object {$_.Line.split(" ")[1]}).exe
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ github.ref_name }}
releaseName: ${{ github.ref_name }}
args: ${{ matrix.args }}
projectPath: ./packages/gui
tauriScript: bun tauri
includeDebug: true