Repository navigation
172 lines (146 loc) · 5.17 KB
/
Copy pathrelease.yml
File metadata and controls
172 lines (146 loc) · 5.17 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
name: Release
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Override version (e.g. 1.2.1). Tag push ignores this."
required: false
type: string
skip_publish:
description: "Build artifacts only; do not create GitHub Release"
required: false
type: boolean
default: false
permissions:
contents: write
jobs:
verify:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Resolve release version
id: ver
shell: pwsh
run: |
$src = & ./.github/scripts/read-version.ps1
if ("${{ github.ref_type }}" -eq "tag") {
$tag = "${{ github.ref_name }}".TrimStart("v")
if ($tag -ne $src) {
throw "Tag v$tag does not match internal/config/version.go ($src). Bump version.go before tagging."
}
$version = $tag
} elseif ("${{ github.event.inputs.version }}" -ne "") {
$version = "${{ github.event.inputs.version }}"
} else {
$version = $src
}
"version=$version" >> $env:GITHUB_OUTPUT
"source=$src" >> $env:GITHUB_OUTPUT
- name: Verify modules
run: go mod verify
- name: Install go-winres
run: go install github.com/tc-hib/go-winres@latest
- name: Embed Windows icon
run: go generate ./...
- name: Test
run: go test ./...
- name: Test (race)
run: go test -race ./...
timeout-minutes: 15
- name: Vet
run: go vet ./...
- name: Extract release notes
shell: pwsh
run: ./.github/scripts/extract-changelog.ps1 -Version "${{ steps.ver.outputs.version }}"
- name: Upload release notes
uses: actions/upload-artifact@v4
with:
name: release-notes-${{ steps.ver.outputs.version }}
path: release_notes.md
retention-days: 30
release:
needs: verify
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Resolve release version
id: ver
shell: pwsh
run: |
$src = & ./.github/scripts/read-version.ps1
if ("${{ github.ref_type }}" -eq "tag") {
$version = "${{ github.ref_name }}".TrimStart("v")
} elseif ("${{ github.event.inputs.version }}" -ne "") {
$version = "${{ github.event.inputs.version }}"
} else {
$version = $src
}
"version=$version" >> $env:GITHUB_OUTPUT
- name: Install go-winres
run: go install github.com/tc-hib/go-winres@latest
- name: Embed Windows icon
run: go generate ./...
- name: Build conduit
run: |
go build -ldflags="-s -w -H=windowsgui -X github.com/foursecondfivefour/conduit/internal/config.Version=${{ steps.ver.outputs.version }}" -tags production -o build/conduit.exe .
- name: Build updater
run: go build -ldflags="-s -w -H=windowsgui" -o build/conduit-updater.exe ./cmd/conduit-updater
- name: SHA256 checksums
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path build | Out-Null
foreach ($file in @("conduit.exe", "conduit-updater.exe")) {
$hash = (Get-FileHash "build\$file" -Algorithm SHA256).Hash.ToLowerInvariant()
Set-Content -Path "build\$file.sha256" -Value $hash -NoNewline
}
- name: Install Inno Setup
run: choco install innosetup -y
- name: Build installer
shell: pwsh
run: |
$iscc = "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe"
& $iscc "/DMyAppVersion=${{ steps.ver.outputs.version }}" "installer\conduit.iss"
- name: Download release notes
uses: actions/download-artifact@v4
with:
name: release-notes-${{ steps.ver.outputs.version }}
path: .
- name: Publish GitHub Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v3
with:
tag_name: ${{ github.ref_name }}
name: Conduit v${{ steps.ver.outputs.version }}
files: |
build/conduit.exe
build/conduit-updater.exe
build/conduit.exe.sha256
build/conduit-updater.exe.sha256
build/Conduit-Setup-${{ steps.ver.outputs.version }}.exe
body_path: release_notes.md
draft: false
generate_release_notes: false
- name: Upload release artifacts (dry run)
if: github.event_name == 'workflow_dispatch'
uses: actions/upload-artifact@v4
with:
name: release-build-${{ steps.ver.outputs.version }}
path: |
build/conduit.exe
build/conduit-updater.exe
build/conduit.exe.sha256
build/conduit-updater.exe.sha256
build/Conduit-Setup-${{ steps.ver.outputs.version }}.exe
release_notes.md
retention-days: 14