-
Notifications
You must be signed in to change notification settings - Fork 0
165 lines (146 loc) · 5.31 KB
/
Copy pathrelease.yml
File metadata and controls
165 lines (146 loc) · 5.31 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
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
build-and-release:
name: Build & Release
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "1.21"
cache: true
- name: Parse version
id: version
shell: bash
run: |
TAG="${GITHUB_REF_NAME}"
VER="${TAG#v}"
COMMIT=$(git rev-parse --short HEAD)
BUILD_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ)
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VER" >> "$GITHUB_OUTPUT"
echo "commit=$COMMIT" >> "$GITHUB_OUTPUT"
echo "build_time=$BUILD_TIME" >> "$GITHUB_OUTPUT"
- name: Install rsrc
run: go install github.com/akavel/rsrc@latest
- name: Embed icon
shell: cmd
run: |
if not exist build\icon.ico (
echo "Missing build\\icon.ico"
exit /b 1
)
rsrc -ico build\icon.ico -o cmd\indus-terminal\rsrc.syso
if not exist cmd\indus-terminal\rsrc.syso (
echo "Icon embed failed: cmd\\indus-terminal\\rsrc.syso not found"
exit /b 1
)
- name: Build binary
shell: cmd
env:
GOOS: windows
GOARCH: amd64
CGO_ENABLED: "0"
run: |
if not exist dist mkdir dist
echo Building console version (ind.exe)...
go build ^
-ldflags "-s -w -X main.version=${{ steps.version.outputs.version }} -X main.commit=${{ steps.version.outputs.commit }} -X main.buildTime=${{ steps.version.outputs.build_time }}" ^
-o dist\ind.exe ^
.\cmd\indus-terminal
copy /Y dist\ind.exe dist\indus.exe >nul
echo Building GUI version (indus-gui.exe)...
go build ^
-ldflags "-s -w -H windowsgui -X main.version=${{ steps.version.outputs.version }} -X main.commit=${{ steps.version.outputs.commit }} -X main.buildTime=${{ steps.version.outputs.build_time }}" ^
-o dist\indus-gui.exe ^
.\cmd\indus-terminal
if not exist dist\ind.exe (
echo "Binary build failed: dist\\ind.exe not found"
exit /b 1
)
if not exist dist\indus.exe (
echo "Alias build failed: dist\\indus.exe not found"
exit /b 1
)
if not exist dist\indus-gui.exe (
echo "GUI build failed: dist\\indus-gui.exe not found"
exit /b 1
)
- name: Run unit tests
shell: powershell
run: go test ./...
- name: Smoke test native commands
shell: powershell
run: |
.\scripts\release_smoke.ps1 -BinaryPath "$pwd\dist\ind.exe" -ReportDir "$pwd\dist"
- name: Install Inno Setup
shell: cmd
run: choco install innosetup --yes --no-progress
- name: Build installer
shell: cmd
run: |
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" installer\indus-setup.iss
if not exist dist\indus-setup.exe (
echo "Installer build failed!"
exit /b 1
)
- name: Rename installer
shell: cmd
run: |
rename dist\indus-setup.exe indus-setup-${{ steps.version.outputs.tag }}-windows-amd64.exe
- name: Generate checksums
shell: powershell
run: |
$files = @(
"dist\ind.exe",
"dist\indus.exe",
"dist\indus-gui.exe",
"dist\indus-setup-${{ steps.version.outputs.tag }}-windows-amd64.exe"
)
$lines = foreach ($f in $files) {
$hash = (Get-FileHash $f -Algorithm SHA256).Hash.ToLower()
"$hash $(Split-Path $f -Leaf)"
}
$lines | Set-Content dist\checksums.txt
Get-Content dist\checksums.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ steps.version.outputs.tag }}
name: "INDUS Terminal ${{ steps.version.outputs.tag }}"
body: |
## INDUS Terminal ${{ steps.version.outputs.tag }}
### Install
1. Download **indus-setup-${{ steps.version.outputs.tag }}-windows-amd64.exe**
2. Run it to install INDUS and add it to PATH
3. Open a new terminal and run `ind` (or `indus`)
### Manual install
- **CLI version**: Download `ind.exe` or `indus.exe`, place in PATH
- **GUI version**: Download `indus-gui.exe` for standalone window (double-click to launch)
---
**Build info**
| | |
|---|---|
| Version | `${{ steps.version.outputs.version }}` |
| Commit | `${{ steps.version.outputs.commit }}` |
| Built | `${{ steps.version.outputs.build_time }}` |
files: |
dist/indus-setup-${{ steps.version.outputs.tag }}-windows-amd64.exe
dist/ind.exe
dist/indus.exe
dist/indus-gui.exe
dist/checksums.txt
dist/smoke-summary.txt
dist/smoke-report.json
draft: false
prerelease: ${{ contains(steps.version.outputs.tag, '-') }}