-
Notifications
You must be signed in to change notification settings - Fork 5
140 lines (123 loc) · 4.18 KB
/
build.yml
File metadata and controls
140 lines (123 loc) · 4.18 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
name: Build SurfManager
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
platform:
description: 'Target Platform'
required: true
default: 'all'
type: choice
options:
- all
- windows-amd64
- linux-amd64
- macos-amd64
- macos-arm64
jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
platform: windows/amd64
output: SurfManager-windows-amd64.exe
name: windows-amd64
- os: ubuntu-latest
platform: linux/amd64
output: SurfManager-linux-amd64
name: linux-amd64
- os: macos-latest
platform: darwin/amd64
output: SurfManager-darwin-amd64
name: macos-amd64
- os: macos-latest
platform: darwin/arm64
output: SurfManager-darwin-arm64
name: macos-arm64
runs-on: ${{ matrix.os }}
steps:
- name: Check platform filter
id: filter
shell: bash
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
echo "skip=false" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.inputs.platform }}" == "all" ]]; then
echo "skip=false" >> $GITHUB_OUTPUT
elif [[ "${{ github.event.inputs.platform }}" == "${{ matrix.name }}" ]]; then
echo "skip=false" >> $GITHUB_OUTPUT
else
echo "skip=true" >> $GITHUB_OUTPUT
fi
echo "Platform filter: input=${{ github.event.inputs.platform }}, matrix=${{ matrix.name }}, skip=$(cat $GITHUB_OUTPUT | grep skip | cut -d= -f2)"
- name: Checkout
if: steps.filter.outputs.skip == 'false'
uses: actions/checkout@v4
- name: Setup Go
if: steps.filter.outputs.skip == 'false'
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Setup Node.js
if: steps.filter.outputs.skip == 'false'
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Wails CLI
if: steps.filter.outputs.skip == 'false'
run: go install github.com/wailsapp/wails/v2/cmd/wails@latest
- name: Install Linux Dependencies
if: steps.filter.outputs.skip == 'false' && startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
- name: Build
if: steps.filter.outputs.skip == 'false'
shell: bash
run: |
if [[ "${{ matrix.os }}" == ubuntu-* ]]; then
wails build -platform ${{ matrix.platform }} -o ${{ matrix.output }} -tags webkit2_41
else
wails build -platform ${{ matrix.platform }} -o ${{ matrix.output }}
fi
- name: Package macOS App
if: steps.filter.outputs.skip == 'false' && startsWith(matrix.os, 'macos')
run: |
cd build/bin
if [ -d "SurfManager.app" ]; then
mv SurfManager.app ${{ matrix.output }}.app
zip -r ${{ matrix.output }}.zip ${{ matrix.output }}.app
fi
- name: Upload Artifact (Windows/Linux)
if: steps.filter.outputs.skip == 'false' && !startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.output }}
path: build/bin/${{ matrix.output }}*
- name: Upload Artifact (macOS)
if: steps.filter.outputs.skip == 'false' && startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.output }}
path: build/bin/${{ matrix.output }}.zip
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Display structure
run: ls -R artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/**/*
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}