-
Notifications
You must be signed in to change notification settings - Fork 2
236 lines (202 loc) · 7.56 KB
/
release.yml
File metadata and controls
236 lines (202 loc) · 7.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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
RUSTC_WRAPPER: ""
jobs:
build-cli:
name: Build CLI (${{ matrix.target }})
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
cross: true
- target: aarch64-apple-darwin
os: macos-latest
archive: tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cross
if: matrix.cross
uses: taiki-e/install-action@cross
- name: Build
env:
RUSTC_WRAPPER: ""
CROSS_CONTAINER_OPTS: "--env RUSTC_WRAPPER="
run: ${{ matrix.cross && 'cross' || 'cargo' }} build --release --target ${{ matrix.target }} -p reasondb-cli ${{ matrix.cross && '--features vendored-openssl' || '' }}
- name: Package (unix)
if: matrix.archive == 'tar.gz'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../reasondb-${{ github.ref_name }}-${{ matrix.target }}.tar.gz reasondb
cd ../../..
- name: Package (windows)
if: matrix.archive == 'zip'
shell: pwsh
run: |
Compress-Archive -Path target/${{ matrix.target }}/release/reasondb.exe -DestinationPath reasondb-${{ github.ref_name }}-${{ matrix.target }}.zip
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: reasondb-${{ matrix.target }}
path: reasondb-${{ github.ref_name }}-${{ matrix.target }}.*
release:
name: Create Release
needs: build-cli
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Generate checksums
run: |
cd artifacts
sha256sum reasondb-* > checksums-sha256.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
artifacts/reasondb-*
artifacts/checksums-sha256.txt
build-desktop:
name: Build Desktop (${{ matrix.platform }} ${{ matrix.args }})
needs: release
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
# Two separate macOS jobs (arm64 + x86_64) instead of one universal
# binary job. Each job notarizes a ~50% smaller binary, cutting
# notarization time and reducing exposure to runner network drops.
# macos-13 was deprecated; macos-latest is the supported runner.
- platform: macos-latest
args: --target aarch64-apple-darwin
rust-targets: aarch64-apple-darwin
- platform: macos-latest
args: --target x86_64-apple-darwin
rust-targets: x86_64-apple-darwin
- platform: windows-latest
args: ''
rust-targets: ''
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: apps/reasondb-client/package-lock.json
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust-targets }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: apps/reasondb-client/src-tauri -> target
- name: Ensure Rust targets are installed
if: matrix.rust-targets != ''
run: |
for target in $(echo "${{ matrix.rust-targets }}" | tr ',' ' '); do
rustup target add $target
done
- name: Build @reasondb/rql-editor workspace package
shell: bash
run: |
cp -r "$GITHUB_WORKSPACE/packages/rql-editor" "$RUNNER_TEMP/rql-editor"
cd "$RUNNER_TEMP/rql-editor"
npm install --ignore-scripts
npm run build
cp -r "$RUNNER_TEMP/rql-editor/dist" "$GITHUB_WORKSPACE/packages/rql-editor/dist"
- name: Install frontend dependencies
shell: bash
run: |
mkdir -p "$RUNNER_TEMP/apps/reasondb-client" "$RUNNER_TEMP/packages"
cp "$GITHUB_WORKSPACE/apps/reasondb-client/package.json" "$RUNNER_TEMP/apps/reasondb-client/"
cp "$GITHUB_WORKSPACE/apps/reasondb-client/package-lock.json" "$RUNNER_TEMP/apps/reasondb-client/"
cp -r "$GITHUB_WORKSPACE/packages/rql-editor/." "$RUNNER_TEMP/packages/rql-editor/"
cd "$RUNNER_TEMP/apps/reasondb-client"
npm ci
rm -rf node_modules/@reasondb/rql-editor
cp -r "$RUNNER_TEMP/packages/rql-editor/." node_modules/@reasondb/rql-editor/
mv node_modules "$GITHUB_WORKSPACE/apps/reasondb-client/node_modules"
- name: Build and release (Tauri)
uses: tauri-apps/tauri-action@v1
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
RUSTC_WRAPPER: ''
NODE_OPTIONS: --max-old-space-size=4096
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
with:
projectPath: apps/reasondb-client
tagName: ${{ github.ref_name }}
releaseName: ReasonDB ${{ github.ref_name }}
releaseBody: |
See the assets below to download and install ReasonDB ${{ github.ref_name }}.
**macOS:** Download the `.dmg` for your chip (`aarch64` = Apple Silicon M1+, `x86_64` = Intel) and drag ReasonDB into your Applications folder.
**Windows:** Download the `.msi` or `.exe` installer and run it.
releaseDraft: false
prerelease: false
retryAttempts: 3
args: ${{ matrix.args }}
update-homebrew:
name: Update Homebrew Tap
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Clone tap repo
env:
TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
git clone "https://x-access-token:${TAP_TOKEN}@github.com/brainfish-ai/homebrew-reasondb-tap.git" tap
- name: Generate formula
run: |
cd tap
bash "${{ github.workspace }}/scripts/update-homebrew.sh" "${{ github.ref_name }}" "${{ github.workspace }}/artifacts"
- name: Push to tap
run: |
cd tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/reasondb.rb
git commit -m "reasondb ${{ github.ref_name }}"
git push