-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (131 loc) · 5.77 KB
/
release.yml
File metadata and controls
147 lines (131 loc) · 5.77 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
# tag push(`v*`)でトリガーされるリリースビルド。
# tauri-apps/tauri-action が各 OS でビルドして GitHub Release にバンドル
# (.deb / .AppImage / .rpm / .msi / .dmg)を upload する。
#
# 署名は alpha 段階では行わない(費用面の理由、README 参照)。
# 将来署名を入れる時は SignPath.io OSS plan / Apple Developer Program /
# クラウド HSM 等を検討、その場合の secrets はワークフロー env に追加する。
name: Release
on:
push:
tags:
- "v*"
# 手動トリガー(リハーサル用)。tag が無い場合は draft release を作る
workflow_dispatch:
jobs:
build:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: ubuntu-22.04
args: ""
# ARM Linux(aarch64)対応。Apple Silicon の Linux VM /
# Raspberry Pi / クラウド ARM サーバ向け。GitHub の public リポは
# 無料で arm64 ランナーが使える。
- platform: ubuntu-22.04-arm
args: ""
- platform: windows-latest
args: ""
# macOS は alpha 段階では配布対象外(README 参照)。CI ビルドが
# 通ることだけ確認するため job は残し、Release には upload しない
- platform: macos-latest
args: "--target universal-apple-darwin"
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# 同梱フォントの submodule を取り込むため。tauri.conf.json の
# bundle.resources が submodule 内パスを参照しているので、
# submodule なしではバンドルが空になる。
submodules: recursive
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: app/pnpm-lock.yaml
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
# macOS universal バイナリ用に追加ターゲットを入れる(matrix の
# macos-latest 行のみで使われる)
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: app/src-tauri -> target
- name: Install Linux build deps
if: startsWith(matrix.platform, 'ubuntu-22.04')
# xdg-utils:tauri-plugin-opener が AppImage バンドル時に xdg-open を
# embed する。x86_64 runner では標準で入っているが、arm runner image
# は薄くて入っていないため明示的にインストールする。
run: |
sudo apt-get update
sudo apt-get install -y \
libwebkit2gtk-4.1-dev \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev \
patchelf \
xdg-utils
- name: Install frontend deps
run: pnpm install --frozen-lockfile
working-directory: app
# tinymist sidecar を target triple ごとに DL。tauri-action が
# bundle.externalBin の実体検証をするため、tauri-action 実行前に
# `app/src-tauri/binaries/tinymist-<triple>` を用意しておく必要がある。
- name: Fetch tinymist (Linux x86_64)
if: matrix.platform == 'ubuntu-22.04'
run: ./scripts/fetch-tinymist.sh
env:
TINYMIST_TARGET: x86_64-unknown-linux-gnu
- name: Fetch tinymist (Linux aarch64)
if: matrix.platform == 'ubuntu-22.04-arm'
run: ./scripts/fetch-tinymist.sh
env:
TINYMIST_TARGET: aarch64-unknown-linux-gnu
- name: Fetch tinymist (Windows x86_64)
if: matrix.platform == 'windows-latest'
shell: bash
run: ./scripts/fetch-tinymist.sh
env:
TINYMIST_TARGET: x86_64-pc-windows-msvc
# macOS は universal-apple-darwin で build するので、x86_64 / aarch64 の
# 両方を DL し lipo で universal バイナリを合成する。
- name: Fetch tinymist (macOS universal)
if: matrix.platform == 'macos-latest'
run: |
TINYMIST_TARGET=aarch64-apple-darwin ./scripts/fetch-tinymist.sh
TINYMIST_TARGET=x86_64-apple-darwin ./scripts/fetch-tinymist.sh
lipo -create \
app/src-tauri/binaries/tinymist-x86_64-apple-darwin \
app/src-tauri/binaries/tinymist-aarch64-apple-darwin \
-output app/src-tauri/binaries/tinymist-universal-apple-darwin
chmod +x app/src-tauri/binaries/tinymist-universal-apple-darwin
- name: Build & upload (tauri-action)
# tag push 時のみ Release に upload。手動トリガーや push (tag 以外)
# では tag-name を空にすると tauri-action が build only で抜ける
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: app
tagName: ${{ startsWith(github.ref, 'refs/tags/') && github.ref_name || '' }}
releaseName: "Yuhitsu ${{ github.ref_name }}"
releaseBody: |
See [PROGRESS.md](https://github.com/barewalker/yuhitsu/blob/main/PROGRESS.md) for changes.
## ⚠️ Notes
- **Windows**: SmartScreen の青い警告が出ますが、「詳細情報」→「実行」で起動できます(個人 OSS のため未署名)
- **macOS**: alpha 段階では配布対象外です(動作未検証)
releaseDraft: true
prerelease: true
args: ${{ matrix.args }}