-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.32 KB
/
Copy pathrelease.yml
File metadata and controls
86 lines (72 loc) · 2.32 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
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
env:
AUTOHOTKEY_VERSION: "2.0.21"
AHK2EXE_VERSION: "1.1.37.02a0a"
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false
jobs:
release:
runs-on: windows-2025
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Validate tag and version
shell: pwsh
run: |
$tag = $env:GITHUB_REF_NAME
if ($tag -notmatch '^v([0-9]+\.[0-9]+\.[0-9]+)$') {
throw "Release tag must look like vX.Y.Z. Actual tag: $tag"
}
$tagVersion = $Matches[1]
$appVersion = (& .\scripts\get-app-version.ps1).Trim()
if ($tagVersion -ne $appVersion) {
throw "Tag version $tagVersion does not match app version $appVersion"
}
git fetch origin master --depth=1
$remoteBranches = git branch -r --contains $env:GITHUB_SHA
if ($remoteBranches -notmatch 'origin/master') {
throw "Tagged commit must be reachable from origin/master"
}
"APP_VERSION=$appVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Download AutoHotkey toolchain
env:
GITHUB_TOKEN: ${{ github.token }}
shell: pwsh
run: |
.\scripts\download-github-toolchain.ps1 `
-AutoHotkeyVersion $env:AUTOHOTKEY_VERSION `
-Ahk2ExeVersion $env:AHK2EXE_VERSION
- name: Build release artifacts
shell: pwsh
run: |
.\scripts\build.ps1 `
-Ahk2ExePath $env:AHK2EXE_PATH `
-BaseFilePath $env:AHK_BASE_FILE
- name: Publish GitHub release
env:
GH_TOKEN: ${{ github.token }}
shell: pwsh
run: |
$tag = $env:GITHUB_REF_NAME
$assets = @(
"dist/AHKeyMap.exe",
"dist/AHKeyMap-v$env:APP_VERSION-windows-x64.zip",
"dist/SHA256SUMS.txt"
)
gh release view $tag *> $null
if ($LASTEXITCODE -eq 0) {
gh release upload $tag $assets --clobber
} else {
gh release create $tag $assets `
--title "AHKeyMap v$env:APP_VERSION" `
--generate-notes
}