-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (99 loc) · 4.15 KB
/
Copy pathrelease.yml
File metadata and controls
119 lines (99 loc) · 4.15 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
name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
publish:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: lts/*
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: npm install
# ✅ Build only (no release), signed so the updater bundle gets a .sig
- name: Build Tauri app
uses: tauri-apps/tauri-action@v0.6.2
with:
args: ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }}
# ✅ Rename installer (and its updater signature alongside it)
- name: Rename installer
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
$version = $tag -replace '^v', ''
$source = "src-tauri/target/release/bundle/nsis/DS4 Dashboard_${version}_x64-setup.exe"
$target = "DS4 Dashboard v$version Installer.exe"
Rename-Item -Path $source -NewName $target
Rename-Item -Path "$source.sig" -NewName "$target.sig"
echo "RENAMED_EXE=src-tauri/target/release/bundle/nsis/$target" >> $env:GITHUB_ENV
echo "RENAMED_SIG=src-tauri/target/release/bundle/nsis/$target.sig" >> $env:GITHUB_ENV
# ✅ Create release
- name: Create GitHub release
shell: pwsh
run: |
$tag = $env:GITHUB_REF_NAME
gh release create $tag `
--title "DS4 Dashboard $tag" `
--notes "🚀 New version of DS4 Dashboard released!`n`nThe latest.json file below is used by the app's convenient update feature, no need to download it manually."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ✅ Upload renamed file with label
- name: Upload installer
shell: pwsh
run: |
$tag = "${env:GITHUB_REF_NAME}"
$version = $tag -replace '^v', ''
$file = "${env:RENAMED_EXE}"
gh release upload $tag "$file#DS4 Dashboard $tag for Windows (.exe installer)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ✅ Build latest.json for the updater to discover this release. The
# installer's real download URL is read back from GitHub's API rather
# than reconstructed locally, because GitHub silently rewrites spaces
# in uploaded release-asset filenames to dots, which would otherwise
# make the URL we compute ourselves point at a 404.
- name: Generate latest.json
shell: pwsh
run: |
$tag = "${env:GITHUB_REF_NAME}"
$version = $tag -replace '^v', ''
$signature = Get-Content -Raw "${env:RENAMED_SIG}"
$url = gh api "repos/${{ github.repository }}/releases/tags/$tag" --jq '.assets[] | select(.name | endswith(".exe")) | .browser_download_url'
$pubDate = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ")
$manifest = @{
version = $version
notes = "See the release notes on GitHub."
pub_date = $pubDate
platforms = @{
"windows-x86_64" = @{
signature = $signature.Trim()
url = $url
}
}
}
$manifest | ConvertTo-Json -Depth 5 | Set-Content -Path "latest.json" -Encoding utf8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ✅ Upload the updater manifest (must be named exactly "latest.json").
# Labeled so it doesn't look like a stray, unexplained file to visitors
# browsing the release page, since GitHub Releases has no way to attach
# a non-public asset, so it can't be hidden outright.
- name: Upload updater manifest
shell: pwsh
run: |
$tag = "${env:GITHUB_REF_NAME}"
gh release upload $tag "latest.json#latest.json (used for convenient updates, read above)"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}