-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (150 loc) · 5.33 KB
/
release.yml
File metadata and controls
178 lines (150 loc) · 5.33 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
name: release (manual)
run-name: Release ${{ github.event.inputs.tag_name }}
on:
workflow_dispatch:
inputs:
tag_name:
description: Release tag to create or update, for example v0.2.0
required: true
type: string
concurrency:
group: release-${{ github.event.inputs.tag_name }}
cancel-in-progress: false
jobs:
preflight:
name: Release Preflight
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev \
librsvg2-dev patchelf libasound2-dev
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache Rust dependencies
uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"
- name: Install frontend dependencies
run: bun install --frozen-lockfile
- name: Run frontend checks
run: |
bun run test
bun run build
- name: Run Rust checks
run: |
cargo check --manifest-path src-tauri/Cargo.toml --all-targets
cargo test --manifest-path src-tauri/Cargo.toml --all-targets --quiet
cargo clippy --manifest-path src-tauri/Cargo.toml --all-targets --all-features -- -D warnings
release:
needs: preflight
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: macos-latest
args: "--target aarch64-apple-darwin"
rust-targets: "aarch64-apple-darwin"
- platform: ubuntu-22.04
args: ""
rust-targets: ""
- platform: windows-latest
args: ""
rust-targets: ""
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4
- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev \
librsvg2-dev patchelf libasound2-dev
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust-targets }}
- name: Cache sherpa-rs-sys binaries
id: sherpa-cache
uses: actions/cache@v4
with:
path: |
~/.cache/sherpa-rs
~/Library/Caches/sherpa-rs
$LOCALAPPDATA/sherpa-rs
key: sherpa-rs-0.6.8-${{ runner.os }}-${{ runner.arch }}
- name: Warn on sherpa-rs cache miss
if: steps.sherpa-cache.outputs.cache-hit != 'true'
run: echo "::warning::sherpa-rs binary cache miss — build will download from network (slower)"
- name: Cache Rust dependencies
uses: swatinem/rust-cache@v2
with:
workspaces: "./src-tauri -> target"
- name: Install frontend dependencies
run: bun install --frozen-lockfile
- name: Build frontend and check bundle size
run: |
bun run build
node <<'NODE'
const fs = require('node:fs');
const path = require('node:path');
const assetsDir = 'dist/assets';
if (!fs.existsSync(assetsDir)) {
console.log('dist/assets not found, skipping size check');
process.exit(0);
}
const chunks = fs
.readdirSync(assetsDir)
.filter((name) => name.endsWith('.js'))
.map((name) => ({
name,
size: fs.statSync(path.join(assetsDir, name)).size,
}))
.sort((a, b) => b.size - a.size);
console.log('Bundle chunks:');
for (const chunk of chunks) {
console.log(` ${chunk.name}: ${Math.round(chunk.size / 1024)} KB`);
}
const totalSize = chunks.reduce((sum, chunk) => sum + chunk.size, 0);
console.log(`Total JS: ${Math.round(totalSize / 1024)} KB`);
const largest = chunks[0];
const warningLimitBytes = 1400 * 1024;
if (largest && largest.size > warningLimitBytes) {
console.log(
`::warning::Largest chunk ${largest.name} is ${Math.round(largest.size / 1024)}KB, exceeds ${Math.round(warningLimitBytes / 1024)}KB warning threshold`,
);
}
NODE
- name: Build and release
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
tagName: ${{ github.event.inputs.tag_name }}
releaseName: "openNotes ${{ github.event.inputs.tag_name }}"
releaseCommitish: ${{ github.sha }}
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}