-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (127 loc) · 4.96 KB
/
Copy pathdesktop-release.yml
File metadata and controls
142 lines (127 loc) · 4.96 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
name: Desktop build & release (Tauri)
on:
push:
branches: [main]
paths:
- 'web/**'
- 'agent/**'
- '.github/workflows/desktop-release.yml'
workflow_dispatch:
concurrency:
group: nightforge-desktop-${{ github.ref }}
cancel-in-progress: true
jobs:
build-desktop:
name: Build desktop (windows)
runs-on: windows-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: npm
cache-dependency-path: web/package-lock.json
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
# Bundle the Python agent as a Tauri sidecar binary (named per target triple).
- name: Build agent sidecar (PyInstaller)
shell: bash
working-directory: agent
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt pyinstaller
pyinstaller --onefile --name nightforge-agent -p . \
--collect-submodules nightforge_agent \
--hidden-import certifi \
--collect-data certifi \
run_agent.py
mkdir -p ../web/src-tauri/binaries
cp dist/nightforge-agent.exe ../web/src-tauri/binaries/nightforge-agent-x86_64-pc-windows-msvc.exe
- name: Install frontend dependencies
working-directory: web
run: npm ci
- name: Verify Tauri bundle assets
shell: bash
working-directory: web
run: |
test -f src-tauri/icons/icon.ico || {
echo "Missing src-tauri/icons/icon.ico — run: npm run desktop:icons"
exit 1
}
- name: Set desktop version and updater config
shell: bash
working-directory: web
env:
RELEASE_VERSION: 0.1.${{ github.run_number }}
UPDATER_ENDPOINT: https://github.com/${{ github.repository }}/releases/latest/download/latest.json
UPDATER_PUBKEY: ${{ secrets.TAURI_UPDATER_PUBKEY }}
run: |
if [ -z "$UPDATER_PUBKEY" ]; then
echo "Secret TAURI_UPDATER_PUBKEY manquant (clé publique minisign du plugin updater)."
exit 1
fi
python << 'PY'
import json, os, re
version = os.environ["RELEASE_VERSION"]
updater_endpoint = os.environ["UPDATER_ENDPOINT"]
updater_pubkey = os.environ["UPDATER_PUBKEY"]
os.chdir("src-tauri")
with open("Cargo.toml", encoding="utf-8") as f:
lines = f.read().splitlines(keepends=True)
in_package = False
out = []
for line in lines:
s = line.strip()
if s == "[package]":
in_package = True
elif s.startswith("[") and s != "[package]":
in_package = False
if in_package and re.match(r"^version\s*=\s*", line):
line = f'version = "{version}"\n'
out.append(line)
with open("Cargo.toml", "w", encoding="utf-8") as f:
f.writelines(out)
with open("tauri.conf.json", encoding="utf-8") as f:
conf = json.load(f)
conf["version"] = version
conf.setdefault("bundle", {})
conf["bundle"]["createUpdaterArtifacts"] = True
conf.setdefault("plugins", {})
conf["plugins"]["updater"] = {
"endpoints": [updater_endpoint],
"pubkey": updater_pubkey,
}
with open("tauri.conf.json", "w", encoding="utf-8") as f:
json.dump(conf, f, indent=2, ensure_ascii=False)
f.write("\n")
print(f"Desktop version set to {version}")
PY
- name: Sync Cargo.lock for new desktop version
working-directory: web/src-tauri
run: cargo update -p nightforge-desktop
- name: Build and publish desktop artifacts
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUXT_PUBLIC_API_BASE: ${{ secrets.NUXT_PUBLIC_API_BASE || 'https://api.nightforge.dibodev.fr' }}
NUXT_PUBLIC_GITHUB_REPO: ${{ github.repository }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
with:
projectPath: web
tagName: v0.1.${{ github.run_number }}
releaseName: 'NightForge Desktop v0.1.${{ github.run_number }}'
releaseBody: |
Build Windows (Tauri + Nuxt) avec agent NightForge embarqué (sidecar).
**Version appli :** `0.1.${{ github.run_number }}`
Mise à jour in-app : le binaire vérifie `latest.json` sur la dernière release GitHub.
releaseDraft: false
prerelease: false