-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (74 loc) · 3 KB
/
CreateAutoHotkeyRelease.yml
File metadata and controls
88 lines (74 loc) · 3 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
name: Create AutoHotkey Release
on:
workflow_dispatch:
push:
tags:
- 'v*'
env:
AUH_script_name: '${{ github.event.repository.name }}'
changelog_name: changelog.md
jobs:
compile-script:
name: 'Compile Script'
runs-on: windows-2022
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: 'recursive'
- name: AutoHotkey Build
uses: nukdokplex/autohotkey-build@v1
with:
version: 'v1.1.33.02'
x64: true
x64_suffix: ''
x86: false
in: '${{ env.AUH_script_name }}.ahk'
out: '.'
- name: Create Changelog From Commit Messages
run: |
$targetTagVersion = ("${{ github.ref }}" -split "/")[-1]
$lastCommitId = ""
$tags = git tag --sort version:refname
foreach($tag in $tags) {
if (-not ($tag -match "^v\d+\.\d+\.\d+$")) {
continue
}
if ($tag -eq "$targetTagVersion") {
break
} else {
$lastCommitId = $tag
}
}
$startCommitId = ""
if ("" -ne $lastCommitId) {
$startCommitId = $lastCommitId
} else {
$startCommitId = git rev-list --max-parents=0 "$targetTagVersion"
}
Write-Host "Collecting commit messages from: '$startCommitId'"
$messages = git log --pretty="%s" "$startCommitId...$targetTagVersion"
Write-Host $messages
Write-Host "Creating markdown from changes..."
"Changes:`n" > ${{ env.changelog_name }}
git log --pretty="%s" "$startCommitId...$targetTagVersion" | Sort-Object -Unique {$_} | ForEach-Object {"- $_"} >> ${{ env.changelog_name }}
Write-Host "Created ${{ env.changelog_name }}"
- name: Upload Release Sources as an Artifact
uses: actions/upload-artifact@v4
with:
name: 'ReleaseSources'
path: |
${{ env.AUH_script_name }}.exe
${{ env.changelog_name }}
create-release:
name: 'Create Release'
runs-on: windows-2022
needs: [compile-script]
steps:
- name: Download Release Sources Artifact
uses: actions/download-artifact@v4
with:
name: 'ReleaseSources'
- run: gh release create "${{ github.ref_name }}" --repo "${{ github.repository }}" --draft --verify-tag --title "Release ${{ github.ref_name }}" --notes-file "${{ env.changelog_name }}" *.exe
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}