Repository navigation
140 lines (127 loc) · 6.41 KB
/
Copy pathalpha.yml
File metadata and controls
140 lines (127 loc) · 6.41 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
# Copyright (c) 2026 Max Aubert. All rights reserved.
# Proprietary source-available software; see LICENSE. SPDX-License-Identifier: LicenseRef-Wind-Proprietary
# Alpha / nightly channel: build an installer from ANY branch, on demand, without touching the
# stable download.
#
# Why this is safe next to release.yml: every build here is published as a GitHub PRE-RELEASE, and
# GitHub's "Latest release" pointer ignores pre-releases. So the download button on the repo, and
# any future in-app updater that asks for the latest release, keep seeing the stable build no
# matter how many alphas exist. release.yml remains the only thing that publishes a real release.
#
# Versioning: src/version.h is still the single source of the version, and an alpha does NOT bump
# it. The tag is v<version>-alpha.<short-sha>, so alphas are unique per commit, sort under the
# stable tag, and can never collide with the release tag for the same version.
#
# Installing an alpha REPLACES a normal Wind install (same install dir, same settings). Rolling
# back is running the stable installer again - it is always one click away on the releases page,
# because it keeps the "Latest" badge.
#
# Build steps: the version read, test gates and installer build live in the composite action
# .github/actions/build-installer, which release.yml uses too. Change a build step there, never
# by adding steps to only one workflow. The alpha tag and asset naming below stay alpha-only.
name: alpha
on:
workflow_dispatch:
inputs:
note:
description: 'What is being tested (goes in the release notes)'
required: false
default: ''
permissions:
contents: write
concurrency:
group: alpha
cancel-in-progress: false
jobs:
alpha:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
# Same build and gates as the stable release (version read, unit tests, keybind JS test,
# Playwright UI suite, tools/release.ps1): an alpha that fails them is not worth installing.
- name: Build installer (shared with release.yml)
id: build
uses: ./.github/actions/build-installer
- name: Compose the alpha tag
id: ver
shell: pwsh
run: |
$v = '${{ steps.build.outputs.version }}'
$sha = '${{ github.sha }}'.Substring(0,7)
"version=$v" >> $env:GITHUB_OUTPUT
"alpha=$v-alpha.$sha" >> $env:GITHUB_OUTPUT
"tag=v$v-alpha.$sha" >> $env:GITHUB_OUTPUT
"sha7=$sha" >> $env:GITHUB_OUTPUT
# tools/release.ps1 names the artefact from src/version.h, which an alpha does not bump - so
# rename it to carry the alpha suffix. Without this every alpha asset would be called
# Wind-Setup-x64-0.4.1.exe and be indistinguishable in a downloads folder.
- name: Name the asset for this alpha
id: asset
shell: pwsh
run: |
$v = '${{ steps.ver.outputs.version }}'
$src = "dist/Wind-Setup-x64-$v.exe"
if (-not (Test-Path $src)) { throw "installer not produced: $src" }
$dst = "dist/Wind-Setup-x64-${{ steps.ver.outputs.alpha }}.exe"
Move-Item $src $dst -Force
"path=$dst" >> $env:GITHUB_OUTPUT
"sha256=$((Get-FileHash $dst -Algorithm SHA256).Hash)" >> $env:GITHUB_OUTPUT
- name: Publish the pre-release
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
ALPHA_NOTE: ${{ inputs.note }}
ALPHA_BRANCH: ${{ github.ref_name }} # a branch name can hold $( ) and backticks
run: |
$ErrorActionPreference = 'Continue'
$PSNativeCommandUseErrorActionPreference = $false
$tag = '${{ steps.ver.outputs.tag }}'
$exe = '${{ steps.asset.outputs.path }}'
$note = $env:ALPHA_NOTE # data, never spliced into the script
$branch = $env:ALPHA_BRANCH
$body = @"
**Alpha build - not a release.** Installs over a normal Wind install and shares its
settings; roll back by running the stable installer from the Latest release.
| | |
|---|---|
| branch | ``$branch`` |
| commit | ``${{ steps.ver.outputs.sha7 }}`` |
| base version | ``${{ steps.ver.outputs.version }}`` |
| sha256 | ``${{ steps.asset.outputs.sha256 }}`` |
$(if ($note) { "**Testing:** $note" })
Unsigned, like the stable build - SmartScreen will warn.
"@
$body | Set-Content notes.md -NoNewline
gh release create $tag $exe --prerelease --target '${{ github.sha }}' --title "Wind ${{ steps.ver.outputs.alpha }}" --notes-file notes.md
if ($LASTEXITCODE -ne 0) { throw 'gh release create failed' }
# Alphas are disposable and accumulate fast. Keep the newest few so a bisect across recent
# builds is still possible, and delete the rest along with their tags.
- name: Prune old alphas
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
$ErrorActionPreference = 'Continue'
$PSNativeCommandUseErrorActionPreference = $false
$keep = 5
$all = gh release list --limit 100 --json tagName,isPrerelease,createdAt | ConvertFrom-Json
$alphas = @($all | Where-Object { $_.isPrerelease -and $_.tagName -like '*-alpha.*' } |
Sort-Object { [datetime]$_.createdAt } -Descending)
if ($alphas.Count -le $keep) { "nothing to prune ($($alphas.Count) alphas)"; exit 0 }
foreach ($old in $alphas[$keep..($alphas.Count-1)]) {
"pruning $($old.tagName)"
gh release delete $old.tagName --yes --cleanup-tag
}
- name: Summary
shell: pwsh
env:
ALPHA_BRANCH: ${{ github.ref_name }}
run: |
"## Wind ${{ steps.ver.outputs.alpha }} (pre-release)" >> $env:GITHUB_STEP_SUMMARY
"" >> $env:GITHUB_STEP_SUMMARY
"- branch ``$env:ALPHA_BRANCH``" >> $env:GITHUB_STEP_SUMMARY
"- tag ``${{ steps.ver.outputs.tag }}``" >> $env:GITHUB_STEP_SUMMARY
"- sha256 ``${{ steps.asset.outputs.sha256 }}``" >> $env:GITHUB_STEP_SUMMARY
"- the stable release keeps the Latest badge; this does not" >> $env:GITHUB_STEP_SUMMARY