Repository navigation
240 lines (213 loc) · 10.5 KB
/
Copy pathrelease.yml
File metadata and controls
240 lines (213 loc) · 10.5 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
237
238
239
name: release
# Triggers:
# - tag vX.Y.Z -> stable vX.Y.Z
# - commit msg contains "release vX.Y.Z" -> stable vX.Y.Z
# - commit msg contains "prerelease" -> prerelease at src/pyproject.toml's version if it's ahead of
# or manual workflow_dispatch the latest stable, else at (latest stable + patch)
on:
push:
branches: [main, dev]
tags: ["v*.*.*"]
workflow_dispatch:
permissions:
contents: write
jobs:
# MARK: parse trigger + move rolling tag --------------------------------
prepare:
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.parse.outputs.tag }}
prerelease: ${{ steps.parse.outputs.prerelease }}
title: ${{ steps.parse.outputs.title }}
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- name: Parse trigger
id: parse
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
tag=""; prerelease=""; title=""
msg=$(git log -1 --pretty=%s)
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
# tag push -> stable
tag="${GITHUB_REF#refs/tags/}"; prerelease=false; title="$tag"
elif [[ "$msg" =~ release[[:space:]]+(v[0-9]+\.[0-9]+\.[0-9]+) ]]; then
# explicit "release vX.Y.Z" commit -> stable
tag="${BASH_REMATCH[1]}"; prerelease=false; title="$tag"
elif [[ "$msg" == *prerelease* || "${{ github.event_name }}" == "workflow_dispatch" ]]; then
# prerelease -> pyproject's version when it's ahead of the latest stable (a bump), else the next patch
base=$(gh api "repos/$GITHUB_REPOSITORY/releases/latest" -q .tag_name 2>/dev/null || true)
base="${base:-v0.0.0}"
want=$(sed -n 's/^version = "\(.*\)"/\1/p' src/pyproject.toml)
if [[ "$want" != "${base#v}" && $(printf '%s\n' "${base#v}" "$want" | sort -V | tail -1) == "$want" ]]; then
tag="v$want"
else
IFS='.' read -r maj min pat <<< "${base#v}"
tag="v${maj}.${min}.$((pat + 1))"
fi
prerelease=true; title="🧪 ${tag} - Prerelease"
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "prerelease=$prerelease" >> "$GITHUB_OUTPUT"
echo "title=$title" >> "$GITHUB_OUTPUT"
- name: Move rolling tag
if: steps.parse.outputs.tag && steps.parse.outputs.prerelease == 'true'
env:
TAG: ${{ steps.parse.outputs.tag }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release delete "$TAG" --yes --cleanup-tag=false 2>/dev/null || true
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag -f "$TAG"
git push origin "refs/tags/$TAG" --force
# MARK: zuv bundle ------------------------------------------------------
bundle:
runs-on: ubuntu-latest
needs: prepare
if: needs.prepare.outputs.tag
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- name: Use the release tag as the app version
shell: bash
env:
TAG: ${{ needs.prepare.outputs.tag }}
run: sed -i "s/^version = .*/version = \"${TAG#v}\"/" src/pyproject.toml
- name: Build zuv bundle
env:
TAG: ${{ needs.prepare.outputs.tag }}
PRERELEASE: ${{ needs.prepare.outputs.prerelease }}
run: |
mkdir -p release
# Stable bundles update from releases/latest ([tool.zuv] update in src/pyproject.toml);
# prerelease bundles from the rolling v999.0.0 prerelease (uploaded in the release job).
update=()
if [ "$PRERELEASE" = "true" ]; then
update=(--update "https://github.com/$GITHUB_REPOSITORY/releases/download/v999.0.0/fhds.zuv.py")
fi
uvx --from "zuv~=0.6.1" zuv src -o release/fhds.zuv.py "${update[@]}"
cp win_start.bat linux_start.sh release/
- uses: actions/upload-artifact@v4
with:
name: bundle
path: release/
# MARK: Windows standalone EXE -----------------------------------------
exe:
runs-on: windows-latest
needs: prepare
if: needs.prepare.outputs.tag
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- name: Use the release tag as the app version
shell: bash
env:
TAG: ${{ needs.prepare.outputs.tag }}
run: sed -i "s/^version = .*/version = \"${TAG#v}\"/" src/pyproject.toml
- name: Build FH-DualSense.exe
shell: pwsh
run: |
uvx --from "pyinstaller>=6.11.1" `
--with PySide6-Essentials --with soundcard --with textual `
--with hidapi --with psutil `
pyinstaller "$Env:GITHUB_WORKSPACE\packaging\windows\fhds.spec" `
--distpath "$Env:GITHUB_WORKSPACE\packaging\windows\dist" `
--workpath "$Env:GITHUB_WORKSPACE\packaging\windows\build" `
--noconfirm --clean
- name: Rename EXE with version
shell: pwsh
run: |
$tag = "${{ needs.prepare.outputs.tag }}"
$dest = "packaging\windows\dist\FH-DualSense-$tag.exe"
Move-Item -Force "packaging\windows\dist\FH-DualSense.exe" $dest
Write-Host "Built $dest"
- uses: actions/upload-artifact@v4
with:
name: exe
path: packaging/windows/dist/FH-DualSense-*.exe
# MARK: Linux standalone ELF -------------------------------------------
elf:
runs-on: ubuntu-latest
needs: prepare
if: needs.prepare.outputs.tag
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v5
- name: Use the release tag as the app version
shell: bash
env:
TAG: ${{ needs.prepare.outputs.tag }}
run: sed -i "s/^version = .*/version = \"${TAG#v}\"/" src/pyproject.toml
- name: Build FH-DualSense (ELF)
run: |
tag="${{ needs.prepare.outputs.tag }}"
uvx --from "pyinstaller>=6.11.1" \
--with PySide6-Essentials --with soundcard --with textual \
--with hidapi --with psutil \
pyinstaller "$GITHUB_WORKSPACE/packaging/linux/fhds.spec" \
--distpath "$GITHUB_WORKSPACE/packaging/linux/dist" \
--workpath "$GITHUB_WORKSPACE/packaging/linux/build" \
--noconfirm --clean
mv "$GITHUB_WORKSPACE/packaging/linux/dist/FH-DualSense" \
"$GITHUB_WORKSPACE/packaging/linux/dist/FH-DualSense-$tag"
echo "Built packaging/linux/dist/FH-DualSense-$tag"
- uses: actions/upload-artifact@v4
with:
name: elf
path: packaging/linux/dist/FH-DualSense-v*
# MARK: combined release -----------------------------------------------
release:
runs-on: ubuntu-latest
needs: [prepare, bundle, exe, elf]
if: needs.prepare.outputs.tag
steps:
- uses: actions/download-artifact@v4
with:
name: bundle
path: release/
- uses: actions/download-artifact@v4
with:
name: exe
path: release/
- uses: actions/download-artifact@v4
with:
name: elf
path: release/
- uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prepare.outputs.tag }}
name: ${{ needs.prepare.outputs.title }}
prerelease: ${{ needs.prepare.outputs.prerelease == 'true' }}
generate_release_notes: true
body: |
## ✅ Recommended: launcher scripts
Download **`win_start.bat`** (Windows) or **`linux_start.sh`** (Linux), drop it in any folder, and double-click. The launcher fetches `fhds.zuv.py`, installs `uv` if needed, runs the app, and self-updates on every launch. This is the supported path and works the same across all Windows versions.
## 🧪 Experimental: standalone binaries
`FH-DualSense.exe` (Windows) and `FH-DualSense-vX.Y.Z` (Linux) are one-file GUI builds (no install, MEIPASS auto-cleans on exit). They are **experimental** and do **not** self-update. The Linux binary is built on Ubuntu, so very old or very different distros may need the launcher instead. Prefer the launcher scripts unless you specifically can't run them.
---
> **Heads up**
> - The bundle self-updates each run from this release. Keep `fhds.zuv.py` next to your launcher script.
> - Settings live in `app/.zuv/fhds/data/user_preferences.json` and survive updates.
> - Coming from v1.6.2 or older: your settings move to `app/.zuv/fhds/data/` on the first start, nothing to do. Afterwards `app/.zuv/fhds.zuv_*`, `app/.zuv/uv-cache` and the `app/.zuv/.zuv-*` files are unused and safe to delete. Going back to an older version won't see those settings unless you copy `app/.zuv/fhds/data/*` to `app/.zuv/data/`.
> - Linux: launcher offers to install `70-dualsense.rules` to `/etc/udev/rules.d/` once.
> - Updates: the app asks before installing one. Turn the check off in the System tab, or set `ZUV_AUTO_UPDATE=1` (install without asking) / `0` (never check).
> - Prerelease channel: set `PRERELEASE=true` in the launcher. Prerelease bundles follow the newest prerelease (rolling `v999.0.0`), not the stable release.
---
Third-party licenses: the window UI uses [Qt for Python (PySide6)](https://doc.qt.io/qtforpython-6/), licensed under the [GNU LGPL v3](https://www.gnu.org/licenses/lgpl-3.0.html), used unmodified. The standalone binaries include it and can be rebuilt against any compatible PySide6 from the source in this release (`packaging/`).
files: release/*
# Rolling prerelease channel: launchers with PRERELEASE=true download from here,
# and prerelease bundles check it for updates.
- name: Update the rolling v999.0.0 prerelease
if: needs.prepare.outputs.prerelease == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
TAG: ${{ needs.prepare.outputs.tag }}
run: |
gh release view v999.0.0 >/dev/null 2>&1 || gh release create v999.0.0 --prerelease --latest=false \
--title "🧪 Rolling prerelease" --notes "Newest prerelease bundle. See the numbered prerelease for its notes."
gh release edit v999.0.0 --notes "Newest prerelease bundle: $TAG."
gh release upload v999.0.0 release/fhds.zuv.py release/win_start.bat release/linux_start.sh --clobber