-
Notifications
You must be signed in to change notification settings - Fork 0
239 lines (206 loc) · 9.1 KB
/
build.yml
File metadata and controls
239 lines (206 loc) · 9.1 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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: Build ForgeFlow
on:
push:
tags: ["v*"]
pull_request:
branches: [master, main]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
platform: windows
arch: amd64
- os: windows-latest
platform: windows
arch: arm64
- os: macos-latest
platform: darwin
arch: amd64
- os: macos-latest
platform: darwin
arch: arm64
- os: ubuntu-latest
platform: linux
arch: amd64
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version from tag or use default
id: version
shell: bash
run: |
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/v}
else
VERSION="0.3.0-dev"
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Building version: $VERSION"
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: "1.23"
cache: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Sync version to all files
run: node scripts/sync-version.js
- name: Install NSIS (Windows)
if: matrix.os == 'windows-latest'
run: |
choco install nsis -y
$env:PATH = "C:\Program Files (x86)\NSIS;$env:PATH"
echo "C:\Program Files (x86)\NSIS" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
makensis /VERSION
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
- name: Setup webkit2gtk-4.0 compatibility
if: matrix.os == 'ubuntu-latest'
run: |
sudo ln -sf /usr/lib/x86_64-linux-gnu/pkgconfig/webkit2gtk-4.1.pc /usr/lib/x86_64-linux-gnu/pkgconfig/webkit2gtk-4.0.pc
- name: Install Wails CLI
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Build (Windows with NSIS)
if: matrix.os == 'windows-latest'
run: |
wails build -platform ${{ matrix.platform }}/${{ matrix.arch }} -nsis
dir build\bin
- name: Build (macOS/Linux)
if: matrix.os != 'windows-latest'
run: wails build -platform ${{ matrix.platform }}/${{ matrix.arch }}
- name: Rename artifacts with version (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
if (Test-Path "build/bin/ForgeFlow.exe") {
Rename-Item "build/bin/ForgeFlow.exe" "ForgeFlow-v${{ steps.version.outputs.version }}-windows-${{ matrix.arch }}.exe"
}
if (Test-Path "build/bin/ForgeFlow-${{ matrix.arch }}-installer.exe") {
Rename-Item "build/bin/ForgeFlow-${{ matrix.arch }}-installer.exe" "ForgeFlow-v${{ steps.version.outputs.version }}-windows-${{ matrix.arch }}-installer.exe"
}
- name: Rename artifacts with version (macOS)
if: matrix.os == 'macos-latest'
run: |
if [ -d "build/bin/ForgeFlow.app" ]; then
mv "build/bin/ForgeFlow.app" "build/bin/ForgeFlow-v${{ steps.version.outputs.version }}-macos-${{ matrix.arch }}.app"
fi
- name: Rename artifacts with version (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
if [ -f "build/bin/ForgeFlow" ]; then
mv "build/bin/ForgeFlow" "build/bin/ForgeFlow-v${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}"
fi
- name: Upload artifact (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: ForgeFlow-windows-${{ matrix.arch }}
path: |
build/bin/ForgeFlow-v${{ steps.version.outputs.version }}-windows-${{ matrix.arch }}.exe
build/bin/ForgeFlow-v${{ steps.version.outputs.version }}-windows-${{ matrix.arch }}-installer.exe
- name: Upload artifact (macOS)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: ForgeFlow-macos-${{ matrix.arch }}
path: build/bin/ForgeFlow-v${{ steps.version.outputs.version }}-macos-${{ matrix.arch }}.app
- name: Upload artifact (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: ForgeFlow-linux-${{ matrix.arch }}
path: build/bin/ForgeFlow-v${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}
release:
needs: build
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Get version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Release version: $VERSION"
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir -p release
echo "=== Listing all artifacts ==="
ls -la artifacts/
echo "=== Windows amd64 ==="
ls -la artifacts/ForgeFlow-windows-amd64/ || true
if [ -f artifacts/ForgeFlow-windows-amd64/ForgeFlow-v${{ steps.version.outputs.version }}-windows-amd64.exe ]; then
cp artifacts/ForgeFlow-windows-amd64/ForgeFlow-v${{ steps.version.outputs.version }}-windows-amd64.exe release/
fi
if [ -f artifacts/ForgeFlow-windows-amd64/ForgeFlow-v${{ steps.version.outputs.version }}-windows-amd64-installer.exe ]; then
cp artifacts/ForgeFlow-windows-amd64/ForgeFlow-v${{ steps.version.outputs.version }}-windows-amd64-installer.exe release/
fi
echo "=== Windows arm64 ==="
ls -la artifacts/ForgeFlow-windows-arm64/ || true
if [ -f artifacts/ForgeFlow-windows-arm64/ForgeFlow-v${{ steps.version.outputs.version }}-windows-arm64.exe ]; then
cp artifacts/ForgeFlow-windows-arm64/ForgeFlow-v${{ steps.version.outputs.version }}-windows-arm64.exe release/
fi
if [ -f artifacts/ForgeFlow-windows-arm64/ForgeFlow-v${{ steps.version.outputs.version }}-windows-arm64-installer.exe ]; then
cp artifacts/ForgeFlow-windows-arm64/ForgeFlow-v${{ steps.version.outputs.version }}-windows-arm64-installer.exe release/
fi
echo "=== macOS amd64 ==="
ls -la artifacts/ForgeFlow-macos-amd64/ || true
if [ -d "artifacts/ForgeFlow-macos-amd64/Contents" ]; then
# The .app was extracted, need to recreate it
cd artifacts/ForgeFlow-macos-amd64
zip -r ../../release/ForgeFlow-v${{ steps.version.outputs.version }}-macos-amd64.zip Contents
cd ../..
elif [ -d "artifacts/ForgeFlow-macos-amd64/ForgeFlow-v${{ steps.version.outputs.version }}-macos-amd64.app" ]; then
cd artifacts/ForgeFlow-macos-amd64
zip -r ../../release/ForgeFlow-v${{ steps.version.outputs.version }}-macos-amd64.zip ForgeFlow-v${{ steps.version.outputs.version }}-macos-amd64.app
cd ../..
fi
echo "=== macOS arm64 ==="
ls -la artifacts/ForgeFlow-macos-arm64/ || true
if [ -d "artifacts/ForgeFlow-macos-arm64/Contents" ]; then
# The .app was extracted, need to recreate it
cd artifacts/ForgeFlow-macos-arm64
zip -r ../../release/ForgeFlow-v${{ steps.version.outputs.version }}-macos-arm64.zip Contents
cd ../..
elif [ -d "artifacts/ForgeFlow-macos-arm64/ForgeFlow-v${{ steps.version.outputs.version }}-macos-arm64.app" ]; then
cd artifacts/ForgeFlow-macos-arm64
zip -r ../../release/ForgeFlow-v${{ steps.version.outputs.version }}-macos-arm64.zip ForgeFlow-v${{ steps.version.outputs.version }}-macos-arm64.app
cd ../..
fi
echo "=== Linux amd64 ==="
ls -la artifacts/ForgeFlow-linux-amd64/ || true
if [ -f artifacts/ForgeFlow-linux-amd64/ForgeFlow-v${{ steps.version.outputs.version }}-linux-amd64 ]; then
cp artifacts/ForgeFlow-linux-amd64/ForgeFlow-v${{ steps.version.outputs.version }}-linux-amd64 release/
chmod +x release/ForgeFlow-v${{ steps.version.outputs.version }}-linux-amd64
fi
echo "=== Final release files ==="
ls -lah release/
- name: Generate checksums
run: |
cd release
sha256sum * > SHA256SUMS.txt
cat SHA256SUMS.txt
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: release/*
fail_on_unmatched_files: false
generate_release_notes: true
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}