-
Notifications
You must be signed in to change notification settings - Fork 0
197 lines (164 loc) · 6.81 KB
/
Copy pathrelease.yml
File metadata and controls
197 lines (164 loc) · 6.81 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
# RunDock — Release Workflow
# Triggers on version tags (v*) → builds release binary → creates Inno Setup installer → publishes GitHub release
# https://github.com/damingishere-coder/RunDock
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
BINARY_NAME: alter
jobs:
# ─────────────────────────────────────────────────────────────────────────────
# Build Windows x64 release binary
# ─────────────────────────────────────────────────────────────────────────────
build-windows:
name: Build (Windows x64)
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-msvc
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: web-ui/package-lock.json
- name: Build web UI
run: |
cd web-ui
npm ci
npm run build
- name: Build release binary
env:
GH_OAUTH_CLIENT_ID: ${{ secrets.GH_OAUTH_CLIENT_ID }}
run: cargo build --release --target x86_64-pc-windows-msvc
# Copy binary to target/release/ where Inno Setup script expects it
- name: Stage binary
run: |
New-Item -ItemType Directory -Force -Path target\release | Out-Null
Copy-Item target\x86_64-pc-windows-msvc\release\alter.exe target\release\alter.exe
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: rundock-windows-x64
path: target/release/alter.exe
# ─────────────────────────────────────────────────────────────────────────────
# Package: Inno Setup installer
# ─────────────────────────────────────────────────────────────────────────────
package-installer:
name: Package Installer
runs-on: windows-latest
needs: build-windows
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download binary
uses: actions/download-artifact@v4
with:
name: rundock-windows-x64
path: target/release
- name: Extract version from tag
id: version
shell: pwsh
run: |
$tag = "${{ github.ref_name }}"
$version = $tag.TrimStart("v")
echo "VERSION=$version" >> $env:GITHUB_OUTPUT
echo "TAG=$tag" >> $env:GITHUB_OUTPUT
- name: Update version in Inno Setup script
shell: pwsh
run: |
$iss = Get-Content installer\alter-setup.iss -Raw
$iss = $iss -replace '#define AppVersion\s+"[^"]+"', "#define AppVersion `"${{ steps.version.outputs.VERSION }}`""
Set-Content installer\alter-setup.iss $iss
- name: Install Inno Setup
run: choco install innosetup --no-progress -y
- name: Build installer
run: |
New-Item -ItemType Directory -Force -Path dist | Out-Null
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer\alter-setup.iss
- name: Compute SHA256
id: sha256
shell: pwsh
run: |
$file = Get-ChildItem dist\*.exe | Select-Object -First 1
$hash = (Get-FileHash $file.FullName -Algorithm SHA256).Hash.ToLower()
echo "HASH=$hash" >> $env:GITHUB_OUTPUT
echo "INSTALLER=$($file.Name)" >> $env:GITHUB_OUTPUT
Write-Host "SHA256: $hash"
- name: Upload installer artifact
uses: actions/upload-artifact@v4
with:
name: rundock-installer
path: dist/*.exe
- name: Save hash for manifest step
uses: actions/upload-artifact@v4
with:
name: installer-hash
path: dist/
outputs:
version: ${{ steps.version.outputs.VERSION }}
installer: ${{ steps.sha256.outputs.INSTALLER }}
sha256: ${{ steps.sha256.outputs.HASH }}
# ─────────────────────────────────────────────────────────────────────────────
# Publish GitHub Release
# ─────────────────────────────────────────────────────────────────────────────
publish-release:
name: Publish GitHub Release
runs-on: ubuntu-latest
needs: package-installer
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download installer
uses: actions/download-artifact@v4
with:
name: rundock-installer
path: dist/
- name: Generate release notes
id: notes
run: |
VERSION="${{ needs.package-installer.outputs.version }}"
INSTALLER="${{ needs.package-installer.outputs.installer }}"
SHA256="${{ needs.package-installer.outputs.sha256 }}"
cat >> $GITHUB_OUTPUT << EOF
BODY<<ENDBODY
## RunDock v${VERSION}
### Windows installer
Download \`${INSTALLER}\` below, run it, and follow the wizard.
\`alter.exe\` will be added to your PATH automatically.
### Verify download
\`\`\`
SHA256: ${SHA256}
\`\`\`
### What's New
See [CHANGELOG](https://github.com/damingishere-coder/RunDock/blob/main/docs/CHANGELOG.md) for details.
ENDBODY
EOF
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: RunDock v${{ needs.package-installer.outputs.version }}
body: ${{ steps.notes.outputs.BODY }}
files: dist/*.exe
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
generate_release_notes: false