-
Notifications
You must be signed in to change notification settings - Fork 0
195 lines (166 loc) · 6.92 KB
/
release.yml
File metadata and controls
195 lines (166 loc) · 6.92 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version tag (e.g., v1.0.0)"
required: false
permissions:
contents: write
jobs:
# Get version
prepare:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version
id: version
run: |
if [ -n "${{ github.event.inputs.version }}" ]; then
echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
# Build KDE Plasmoid
build-plasmoid:
needs: prepare
uses: ./.github/workflows/build-plasmoid.yml
with:
version: ${{ needs.prepare.outputs.version }}
# Build Tauri tray app
build-tray:
needs: prepare
uses: ./.github/workflows/build-tray.yml
with:
version: ${{ needs.prepare.outputs.version }}
secrets:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
# Create GitHub Release
release:
needs: [prepare, build-plasmoid, build-tray]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch'
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Collect distributable artifacts
shell: bash
run: |
mkdir -p release
# Only copy files NOT handled by add_platform (which handles .AppImage, .exe, .app.tar.gz + their .sig files)
find artifacts -type f \( -name "*.plasmoid" -o -name "*.deb" -o -name "*.rpm" -o -name "*.dmg" \) -print0 | while IFS= read -r -d '' file; do
name=$(basename "$file" | tr ' ' '.')
cp "$file" "release/$name"
done
- name: Generate latest.json and collect updater artifacts
shell: bash
run: |
VERSION="${{ needs.prepare.outputs.version }}"
VERSION="${VERSION#v}"
PUB_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
REPO="jaredcat/plasmoid-lgtv-remote"
TAG="${{ needs.prepare.outputs.version }}"
# Find a single file by glob pattern within a directory (space-safe)
find_one() {
find "$1" -name "$2" -type f -print0 2>/dev/null | head -z -n1 | tr -d '\0'
}
# GitHub Releases replaces spaces with dots in asset filenames.
# Sanitize to match and avoid 404s.
sanitize() {
echo "$1" | tr ' ' '.'
}
PLATFORMS='{}'
# add_platform KEY ARTIFACT_DIR GLOB [RENAME]
# RENAME is optional; use it to disambiguate files that share a name (e.g. macOS arch)
add_platform() {
local key="$1" dir="$2" pattern="$3" rename="$4"
local file sig_file sig name
file=$(find_one "$dir" "$pattern")
if [ -z "$file" ]; then
echo "SKIP $key: no $pattern in $dir"
return
fi
sig_file="${file}.sig"
if [ ! -f "$sig_file" ]; then
echo "SKIP $key: no signature for $(basename "$file")"
return
fi
sig=$(cat "$sig_file")
# Determine the release asset filename
if [ -n "$rename" ]; then
name="$rename"
else
name=$(sanitize "$(basename "$file")")
fi
# Copy artifact + sig to release/ under the sanitized/renamed name
cp "$file" "release/$name"
cp "$sig_file" "release/${name}.sig"
local url="https://github.com/$REPO/releases/download/$TAG/$name"
PLATFORMS=$(python3 -c "
import json, sys
d = json.load(sys.stdin)
d[sys.argv[1]] = {'url': sys.argv[2], 'signature': sys.argv[3]}
json.dump(d, sys.stdout)
" "$key" "$url" "$sig" <<< "$PLATFORMS")
echo "OK: $key -> $name"
}
add_platform "linux-x86_64" "artifacts/lgtv-tray-linux" "*.AppImage"
add_platform "windows-x86_64" "artifacts/lgtv-tray-windows" "*-setup.exe"
add_platform "darwin-aarch64" "artifacts/lgtv-tray-macos-arm64" "*.app.tar.gz" "LG.TV.Remote_${VERSION}_aarch64.app.tar.gz"
add_platform "darwin-x86_64" "artifacts/lgtv-tray-macos-x64" "*.app.tar.gz" "LG.TV.Remote_${VERSION}_x86_64.app.tar.gz"
python3 -c "
import json, sys
platforms = json.load(sys.stdin)
manifest = {'version': sys.argv[1], 'pub_date': sys.argv[2], 'platforms': platforms}
with open('release/latest.json', 'w') as f:
json.dump(manifest, f, indent=2)
print(json.dumps(manifest, indent=2))
" "$VERSION" "$PUB_DATE" <<< "$PLATFORMS"
- name: Delete existing release if re-running
run: |
TAG="${{ needs.prepare.outputs.version }}"
RELEASE_ID=$(curl -sf \
-H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/releases/tags/$TAG" \
| python3 -c "import sys,json; print(json.load(sys.stdin).get('id',''))" 2>/dev/null) || true
if [ -n "$RELEASE_ID" ]; then
curl -sf -X DELETE \
-H "Authorization: token $GITHUB_TOKEN" \
"https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID" || true
echo "Deleted existing release $RELEASE_ID for $TAG"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.prepare.outputs.version }}
files: release/*
generate_release_notes: true
body: |
## LG TV Remote ${{ needs.prepare.outputs.version }}
### Downloads
**Cross-Platform Tray App** (Windows, macOS, Linux):
- **Windows**: `.exe` (installer)
- **macOS**: `.dmg` (Intel: x64, Apple Silicon: arm64)
- **Linux**: `.AppImage` (universal), `.deb` (Debian/Ubuntu), `.rpm` (Fedora/RHEL)
**KDE Plasma Widget** (Linux with KDE Plasma 6):
- `lgtv-remote.plasmoid` - Install via System Settings or `kpackagetool6 -t Plasma/Applet -i lgtv-remote.plasmoid`
### First-Time Setup
1. Enter your TV's IP address (find in TV Settings → Network)
2. Click **Authenticate** and accept the pairing prompt on your TV
3. Use the remote controls or keyboard shortcuts
### Requirements
- **Plasmoid**: Python 3 with `websockets` module
- **Tray App**: No additional dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}