-
-
Notifications
You must be signed in to change notification settings - Fork 516
202 lines (202 loc) · 8.95 KB
/
release.yml
File metadata and controls
202 lines (202 loc) · 8.95 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
name: Build WinBoat
permissions:
contents: write
on:
push:
branches:
- main
tags:
- "v*"
workflow_dispatch:
inputs:
build_type:
description: "Build type"
required: true
default: "all"
type: choice
options:
- all
- linux-only
- guest-server-only
jobs:
build:
runs-on: ubuntu-22.04
if: >-
(github.event_name == 'push' && !startsWith(github.ref, 'refs/tags/')) ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.build_type != 'guest-server-only')
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Update USB IDs database
run: |
echo "Removing old usb.ids file..."
rm -f data/usb.ids
echo "Downloading latest usb.ids from linux-usb.org..."
curl -o data/usb.ids http://www.linux-usb.org/usb.ids
echo "USB IDs database updated successfully"
- name: Show build type
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "Manual workflow triggered with build type: ${{ github.event.inputs.build_type }}"
else
echo "Automatic workflow triggered by ${{ github.event_name }}"
fi
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev libusb-1.0-0-dev
- name: Set up Bun
uses: oven-sh/setup-bun@v2
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "stable"
cache-dependency-path: "guest_server/go.sum"
- name: Install dependencies
run: bun ci
- name: Build guest server and app
run: bun run build:linux-gs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ELECTRON_BUILDER_COMPRESSION_LEVEL: 5
- name: Derive artifact naming
id: meta
shell: bash
run: |
bun -e "const p=require('./package.json'); console.log('NAME='+p.name)" >> "$GITHUB_OUTPUT"
bun -e "const p=require('./package.json'); console.log('VERSION='+p.version)" >> "$GITHUB_OUTPUT"
ARCH_FROM_FILE=$(ls dist/*.{AppImage,deb,rpm,tar.bz2} 2>/dev/null | head -n1 | xargs -I{} basename {} | sed -E 's/.*-([A-Za-z0-9_]+)\.[^.]+$/\1/')
if [ -n "$ARCH_FROM_FILE" ]; then
echo "ARCH=$ARCH_FROM_FILE" >> "$GITHUB_OUTPUT"
else
BUN_ARCH=$(bun -p "process.arch")
case "$BUN_ARCH" in
x64) echo "ARCH=x86_64" >> "$GITHUB_OUTPUT" ;;
arm64) echo "ARCH=arm64" >> "$GITHUB_OUTPUT" ;;
arm) echo "ARCH=armv7l" >> "$GITHUB_OUTPUT" ;;
*) echo "ARCH=$BUN_ARCH" >> "$GITHUB_OUTPUT" ;;
esac
fi
- name: Upload AppImage
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.NAME }}-${{ steps.meta.outputs.VERSION }}-${{ steps.meta.outputs.ARCH }}.appimage
path: dist/*.AppImage
if-no-files-found: ignore
- name: Upload DEB
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.NAME }}-${{ steps.meta.outputs.VERSION }}-${{ steps.meta.outputs.ARCH }}.deb
path: dist/*.deb
if-no-files-found: ignore
- name: Upload RPM
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.NAME }}-${{ steps.meta.outputs.VERSION }}-${{ steps.meta.outputs.ARCH }}.rpm
path: dist/*.rpm
if-no-files-found: ignore
- name: Upload TAR.BZ2
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.NAME }}-${{ steps.meta.outputs.VERSION }}-${{ steps.meta.outputs.ARCH }}.tar.bz2
path: dist/*.tar.bz2
if-no-files-found: ignore
- name: Upload unpacked directory
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.NAME }}-${{ steps.meta.outputs.VERSION }}-${{ steps.meta.outputs.ARCH }}-unpacked.zip
path: dist/linux-unpacked/**
if-no-files-found: ignore
- name: Upload guest server zip
uses: actions/upload-artifact@v4
with:
name: ${{ steps.meta.outputs.NAME }}-${{ steps.meta.outputs.VERSION }}-${{ steps.meta.outputs.ARCH }}-guest_server.zip
path: dist/linux-unpacked/resources/guest_server/winboat_guest_server.zip
if-no-files-found: ignore
# - name: Upload metadata
# uses: actions/upload-artifact@v4
# with:
# name: ${{ steps.meta.outputs.NAME }}-${{ steps.meta.outputs.VERSION }}-${{ steps.meta.outputs.ARCH }}-metadata
# path: |
# dist/latest-linux.yml
# dist/linux-unpacked/resources/guest_server/winboat_guest_server.zip
# if-no-files-found: ignore
guest-server-only:
runs-on: ubuntu-22.04
if: github.event_name == 'workflow_dispatch' && github.event.inputs.build_type == 'guest-server-only'
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Show build type
run: |
echo "Manual workflow triggered with build type: guest-server-only"
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "stable"
cache-dependency-path: "guest_server/go.sum"
- name: Build guest server only
run: bash build-guest-server.sh
- name: Upload guest server artifacts
uses: actions/upload-artifact@v4
with:
name: guest-server-artifacts
path: guest_server/
release:
runs-on: ubuntu-22.04
if: >-
startsWith(github.ref, 'refs/tags/') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.build_type == 'all')
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Update USB IDs database
run: |
echo "Removing old usb.ids file..."
rm -f data/usb.ids
echo "Downloading latest usb.ids from linux-usb.org..."
curl -o data/usb.ids http://www.linux-usb.org/usb.ids
echo "USB IDs database updated successfully"
- name: Show build type
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "Manual workflow triggered with build type: ${{ github.event.inputs.build_type }}"
else
echo "Release workflow triggered by tag: ${{ github.ref_name }}"
fi
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev libusb-1.0-0-dev
- name: Set up Bun
uses: oven-sh/setup-bun@v2
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: "stable"
cache-dependency-path: "guest_server/go.sum"
- name: Install dependencies
run: bun ci
- name: Build guest server and app
run: bun run build:linux-gs
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ELECTRON_BUILDER_COMPRESSION_LEVEL: 5
- name: Zip unpacked variant
run: cd dist && zip -r winboat-linux-unpacked.zip linux-unpacked/
- name: Create GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.AppImage
dist/*.deb
dist/*.rpm
dist/*.tar.bz2
dist/winboat-linux-unpacked.zip
dist/latest-linux.yml
dist/linux-unpacked/resources/guest_server/winboat_guest_server.zip
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}