|
1 | | -# name: Desktop build & release (Tauri) |
2 | | - |
3 | | -# on: |
4 | | -# push: |
5 | | -# branches: [main] |
6 | | -# paths: |
7 | | -# - 'web/**' |
8 | | -# - '.github/workflows/desktop-release.yml' |
9 | | -# workflow_dispatch: |
10 | | - |
11 | | -# concurrency: |
12 | | -# group: goupixdex-desktop-${{ github.ref }} |
13 | | -# cancel-in-progress: true |
14 | | - |
15 | | -# jobs: |
16 | | -# build-desktop: |
17 | | -# name: Build desktop (${{ matrix.platform }}) |
18 | | -# # Évite l'avertissement « actions JS sur Node 20 » (passage Node 24 côté runner GitHub). |
19 | | -# env: |
20 | | -# FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
21 | | -# permissions: |
22 | | -# contents: write |
23 | | -# strategy: |
24 | | -# fail-fast: false |
25 | | -# matrix: |
26 | | -# include: |
27 | | -# - platform: macos-latest |
28 | | -# args: --target x86_64-apple-darwin |
29 | | -# - platform: macos-latest |
30 | | -# args: --target aarch64-apple-darwin |
31 | | -# - platform: windows-latest |
32 | | -# args: "" |
33 | | -# runs-on: ${{ matrix.platform }} |
34 | | - |
35 | | -# defaults: |
36 | | -# run: |
37 | | -# working-directory: web |
38 | | - |
39 | | -# steps: |
40 | | -# - name: Checkout |
41 | | -# uses: actions/checkout@v6 |
42 | | - |
43 | | -# - name: Setup Node.js |
44 | | -# uses: actions/setup-node@v6 |
45 | | -# with: |
46 | | -# node-version: '24' |
47 | | -# cache: npm |
48 | | -# cache-dependency-path: web/package-lock.json |
49 | | - |
50 | | -# - name: Install pnpm |
51 | | -# uses: pnpm/action-setup@v5 |
52 | | -# with: |
53 | | -# version: 10 |
54 | | - |
55 | | -# - name: Install Rust stable |
56 | | -# uses: dtolnay/rust-toolchain@stable |
57 | | - |
58 | | -# - name: Install macOS Rust targets |
59 | | -# if: startsWith(matrix.platform, 'macos') |
60 | | -# run: | |
61 | | -# rustup target add aarch64-apple-darwin |
62 | | -# rustup target add x86_64-apple-darwin |
63 | | - |
64 | | -# - name: Install frontend dependencies |
65 | | -# run: npm ci |
66 | | - |
67 | | -# # Version unique par run CI (semver patch = run_number) pour futur updater / traçabilité des builds. |
68 | | -# - name: Set desktop version for this release |
69 | | -# shell: bash |
70 | | -# working-directory: web |
71 | | -# env: |
72 | | -# RELEASE_VERSION: 0.1.${{ github.run_number }} |
73 | | -# UPDATER_ENDPOINT: https://github.com/${{ github.repository }}/releases/latest/download/latest.json |
74 | | -# UPDATER_PUBKEY: ${{ secrets.TAURI_UPDATER_PUBKEY }} |
75 | | -# run: | |
76 | | -# if [ -z "$UPDATER_PUBKEY" ]; then |
77 | | -# echo "Secret TAURI_UPDATER_PUBKEY manquant." |
78 | | -# exit 1 |
79 | | -# fi |
80 | | - |
81 | | -# python3 << 'PY' |
82 | | -# import json, os, re |
83 | | -# version = os.environ["RELEASE_VERSION"] |
84 | | -# updater_endpoint = os.environ["UPDATER_ENDPOINT"] |
85 | | -# updater_pubkey = os.environ["UPDATER_PUBKEY"] |
86 | | -# os.chdir("src-tauri") |
87 | | -# with open("Cargo.toml", encoding="utf-8") as f: |
88 | | -# lines = f.read().splitlines(keepends=True) |
89 | | -# in_package = False |
90 | | -# out = [] |
91 | | -# for line in lines: |
92 | | -# s = line.strip() |
93 | | -# if s == "[package]": |
94 | | -# in_package = True |
95 | | -# elif s.startswith("[") and s != "[package]": |
96 | | -# in_package = False |
97 | | -# if in_package and re.match(r"^version\s*=\s*", line): |
98 | | -# line = f'version = "{version}"\n' |
99 | | -# out.append(line) |
100 | | -# with open("Cargo.toml", "w", encoding="utf-8") as f: |
101 | | -# f.writelines(out) |
102 | | -# with open("tauri.conf.json", encoding="utf-8") as f: |
103 | | -# conf = json.load(f) |
104 | | -# conf["version"] = version |
105 | | -# conf.setdefault("bundle", {}) |
106 | | -# conf["bundle"]["createUpdaterArtifacts"] = True |
107 | | -# conf.setdefault("plugins", {}) |
108 | | -# conf["plugins"]["updater"] = { |
109 | | -# "endpoints": [updater_endpoint], |
110 | | -# "pubkey": updater_pubkey |
111 | | -# } |
112 | | -# with open("tauri.conf.json", "w", encoding="utf-8") as f: |
113 | | -# json.dump(conf, f, indent=2, ensure_ascii=False) |
114 | | -# f.write("\n") |
115 | | -# print(f"Desktop version set to {version}") |
116 | | -# PY |
117 | | - |
118 | | -# - name: Sync Cargo.lock for new desktop version |
119 | | -# working-directory: web/src-tauri |
120 | | -# run: cargo update -p goupixdex-desktop |
121 | | - |
122 | | -# - name: Build and publish desktop artifacts |
123 | | -# uses: tauri-apps/tauri-action@v0 |
124 | | -# env: |
125 | | -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
126 | | -# NUXT_PUBLIC_API_BASE: ${{ secrets.NUXT_PUBLIC_API_BASE }} |
127 | | -# NUXT_PUBLIC_GITHUB_REPO: ${{ github.repository }} |
128 | | -# TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} |
129 | | -# TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} |
130 | | -# with: |
131 | | -# projectPath: web |
132 | | -# tagName: v0.1.${{ github.run_number }} |
133 | | -# releaseName: "GoupixDex Desktop v0.1.${{ github.run_number }}" |
134 | | -# releaseBody: | |
135 | | -# Build **production** Windows / macOS (Rust `--release`, pas de console cmd au lancement sur Windows). |
136 | | - |
137 | | -# Installeurs : voir les assets de cette version (.exe, .msi, .dmg). |
138 | | - |
139 | | -# **Version appli :** `0.1.${{ github.run_number }}` (semver patch = numéro de run GitHub Actions, unique à chaque build sur `main`). |
140 | | -# releaseDraft: false |
141 | | -# prerelease: false |
142 | | -# args: ${{ matrix.args }} |
| 1 | +name: Desktop build & release (Tauri) |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + paths: |
| 7 | + - 'web/**' |
| 8 | + - '.github/workflows/desktop-release.yml' |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: goupixdex-desktop-${{ github.ref }} |
| 13 | + cancel-in-progress: true |
| 14 | + |
| 15 | +jobs: |
| 16 | + build-desktop: |
| 17 | + name: Build desktop (${{ matrix.platform }}) |
| 18 | + # Évite l'avertissement « actions JS sur Node 20 » (passage Node 24 côté runner GitHub). |
| 19 | + env: |
| 20 | + FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
| 21 | + permissions: |
| 22 | + contents: write |
| 23 | + strategy: |
| 24 | + fail-fast: false |
| 25 | + matrix: |
| 26 | + include: |
| 27 | + - platform: macos-latest |
| 28 | + args: --target x86_64-apple-darwin |
| 29 | + - platform: macos-latest |
| 30 | + args: --target aarch64-apple-darwin |
| 31 | + - platform: windows-latest |
| 32 | + args: "" |
| 33 | + runs-on: ${{ matrix.platform }} |
| 34 | + |
| 35 | + defaults: |
| 36 | + run: |
| 37 | + working-directory: web |
| 38 | + |
| 39 | + steps: |
| 40 | + - name: Checkout |
| 41 | + uses: actions/checkout@v6 |
| 42 | + |
| 43 | + - name: Setup Node.js |
| 44 | + uses: actions/setup-node@v6 |
| 45 | + with: |
| 46 | + node-version: '24' |
| 47 | + cache: npm |
| 48 | + cache-dependency-path: web/package-lock.json |
| 49 | + |
| 50 | + - name: Install pnpm |
| 51 | + uses: pnpm/action-setup@v5 |
| 52 | + with: |
| 53 | + version: 10 |
| 54 | + |
| 55 | + - name: Install Rust stable |
| 56 | + uses: dtolnay/rust-toolchain@stable |
| 57 | + |
| 58 | + - name: Install macOS Rust targets |
| 59 | + if: startsWith(matrix.platform, 'macos') |
| 60 | + run: | |
| 61 | + rustup target add aarch64-apple-darwin |
| 62 | + rustup target add x86_64-apple-darwin |
| 63 | +
|
| 64 | + - name: Install frontend dependencies |
| 65 | + run: npm ci |
| 66 | + |
| 67 | + # Version unique par run CI (semver patch = run_number) pour futur updater / traçabilité des builds. |
| 68 | + - name: Set desktop version for this release |
| 69 | + shell: bash |
| 70 | + working-directory: web |
| 71 | + env: |
| 72 | + RELEASE_VERSION: 0.1.${{ github.run_number }} |
| 73 | + UPDATER_ENDPOINT: https://github.com/${{ github.repository }}/releases/latest/download/latest.json |
| 74 | + UPDATER_PUBKEY: ${{ secrets.TAURI_UPDATER_PUBKEY }} |
| 75 | + run: | |
| 76 | + if [ -z "$UPDATER_PUBKEY" ]; then |
| 77 | + echo "Secret TAURI_UPDATER_PUBKEY manquant." |
| 78 | + exit 1 |
| 79 | + fi |
| 80 | +
|
| 81 | + python3 << 'PY' |
| 82 | + import json, os, re |
| 83 | + version = os.environ["RELEASE_VERSION"] |
| 84 | + updater_endpoint = os.environ["UPDATER_ENDPOINT"] |
| 85 | + updater_pubkey = os.environ["UPDATER_PUBKEY"] |
| 86 | + os.chdir("src-tauri") |
| 87 | + with open("Cargo.toml", encoding="utf-8") as f: |
| 88 | + lines = f.read().splitlines(keepends=True) |
| 89 | + in_package = False |
| 90 | + out = [] |
| 91 | + for line in lines: |
| 92 | + s = line.strip() |
| 93 | + if s == "[package]": |
| 94 | + in_package = True |
| 95 | + elif s.startswith("[") and s != "[package]": |
| 96 | + in_package = False |
| 97 | + if in_package and re.match(r"^version\s*=\s*", line): |
| 98 | + line = f'version = "{version}"\n' |
| 99 | + out.append(line) |
| 100 | + with open("Cargo.toml", "w", encoding="utf-8") as f: |
| 101 | + f.writelines(out) |
| 102 | + with open("tauri.conf.json", encoding="utf-8") as f: |
| 103 | + conf = json.load(f) |
| 104 | + conf["version"] = version |
| 105 | + conf.setdefault("bundle", {}) |
| 106 | + conf["bundle"]["createUpdaterArtifacts"] = True |
| 107 | + conf.setdefault("plugins", {}) |
| 108 | + conf["plugins"]["updater"] = { |
| 109 | + "endpoints": [updater_endpoint], |
| 110 | + "pubkey": updater_pubkey |
| 111 | + } |
| 112 | + with open("tauri.conf.json", "w", encoding="utf-8") as f: |
| 113 | + json.dump(conf, f, indent=2, ensure_ascii=False) |
| 114 | + f.write("\n") |
| 115 | + print(f"Desktop version set to {version}") |
| 116 | + PY |
| 117 | +
|
| 118 | + - name: Sync Cargo.lock for new desktop version |
| 119 | + working-directory: web/src-tauri |
| 120 | + run: cargo update -p goupixdex-desktop |
| 121 | + |
| 122 | + - name: Build and publish desktop artifacts |
| 123 | + uses: tauri-apps/tauri-action@v0 |
| 124 | + env: |
| 125 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 126 | + NUXT_PUBLIC_API_BASE: ${{ secrets.NUXT_PUBLIC_API_BASE }} |
| 127 | + NUXT_PUBLIC_GITHUB_REPO: ${{ github.repository }} |
| 128 | + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} |
| 129 | + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} |
| 130 | + with: |
| 131 | + projectPath: web |
| 132 | + tagName: v0.1.${{ github.run_number }} |
| 133 | + releaseName: "GoupixDex Desktop v0.1.${{ github.run_number }}" |
| 134 | + releaseBody: | |
| 135 | + Build **production** Windows / macOS (Rust `--release`, pas de console cmd au lancement sur Windows). |
| 136 | +
|
| 137 | + Installeurs : voir les assets de cette version (.exe, .msi, .dmg). |
| 138 | +
|
| 139 | + **Version appli :** `0.1.${{ github.run_number }}` (semver patch = numéro de run GitHub Actions, unique à chaque build sur `main`). |
| 140 | + releaseDraft: false |
| 141 | + prerelease: false |
| 142 | + args: ${{ matrix.args }} |
0 commit comments