-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (66 loc) · 1.99 KB
/
build.yml
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
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: true
matrix:
build:
# - { name: 'TorPlayer-darwin', os: 'macos-latest' }
# - { name: 'TorPlayer-linux', os: 'ubuntu-latest' }
- { name: 'TorPlayer-windows', os: 'windows-latest' }
runs-on: ${{ matrix.build.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
# Setup Golang
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: 1.21
check-latest: true
- run: go version
shell: bash
## MacOS
# Build MacOS
- name: Build MacOS
if: runner.os == 'macOS'
run: |
mkdir -p ./build/bin/TorPlayer.app/Contents/MacOS
mkdir -p ./build/bin/TorPlayer.app/Contents/Resources
cp ./build/darwin/Info.plist ./build/bin/TorPlayer.app/Contents
cp ./build/darwin/iconfile.icns ./build/bin/TorPlayer.app/Contents/Resources
go build -o build/bin/TorPlayer.app/Contents/MacOS/TorPlayer
chmod +x build/bin/*/Contents/MacOS/*
shell: bash
# Package MacOS
- name: Package MacOS
if: runner.os == 'macOS'
run: |
productbuild --component ./build/bin/TorPlayer.app ./build/bin/TorPlayer.pkg
shell: bash
## Windows
# Build Windows
- name: Build Windows
if: runner.os == 'Windows'
run: |
go build -ldflags -H=windowsgui -o build/bin/TorPlayer.exe
shell: bash
# Upload build assets
- uses: actions/upload-artifact@v4
with:
name: Build ${{matrix.build.name}} ${{runner.os}}
path: |
*/bin/*.pkg
*\bin\*.exe
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
*/bin/*.{pkg,exe}