-
Notifications
You must be signed in to change notification settings - Fork 8
177 lines (169 loc) · 6.58 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
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
name: build
on: push
permissions:
packages: write
contents: write
jobs:
build:
name: "Build Dungeondraft-GoPackager (${{ matrix.target.os }}, ${{ matrix.go-version }})"
runs-on: ${{ matrix.target.host || 'ubuntu-latest' }}
env:
GO111MODULE: on
strategy:
fail-fast: false
matrix:
go-version: ["1.23.x"]
target:
- os: linux
- os: windows
ext: .exe
host: windows-latest
- os: darwin
host: macos-latest
steps:
- name: Setup Go environment
id: setup-go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Force "autocrlf"
run: git config --global core.autocrlf input
- name: Checkout code
uses: actions/checkout@v4
- name: Cache build artifacts
uses: actions/cache@v4
with:
path: |
~/go/pkg/mod
~/.cache/go-build
~/.cache/fyne-cross
key: ${{ runner.os }}-build-cache-${{ hashFiles('**/go.sum') }}
# - name: Setup msys2
# if: ${{ runner.os == 'Windows' }}
# uses: msys2/setup-msys2@v2
# with:
# msystem: UCRT64
# install: >-
# base-devel
# mingw-w64-ucrt-x86_64-toolchain
# mingw-w64-ucrt-x86_64-libwebp
# mingw-w64-ucrt-x86_64-go
- name: Install Build Deps (Linux)
if: ${{ runner.os == 'Linux' }}
# run: sudo apt-get install golang gcc libgl1-mesa-dev xorg-dev libwebp-dev
run: sudo apt-get install golang gcc libgl1-mesa-dev xorg-dev
# - name: Install Build Deps (Macos)
# if: ${{ runner.os == 'macOS' }}
# run: brew install webp
- name: Install Fyne (windows)
if: ${{ runner.os == 'Windows' }}
# shell: msys2 {0}
run: |
# export GOROOT=/ucrt64/lib/go
# export GOPATH=/ucrt64
go install fyne.io/fyne/v2/cmd/fyne@latest
- name: Install Fyne
if: ${{ runner.os != 'Windows' }}
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: install go deps (windows)
if: ${{ runner.os == 'Windows' }}
# shell: msys2 {0}
run: |
# export GOROOT=/ucrt64/lib/go
# export GOPATH=/ucrt64
go mod download
- name: install go deps
if: ${{ runner.os != 'Windows' }}
run: go mod download
- name: Build gui (windows)
if: ${{ runner.os == 'Windows' }}
# shell: msys2 {0}
run: |
# export GOROOT=/ucrt64/lib/go
# export GOPATH=/ucrt64
cp FyneApp.toml ./cmd/dungeondraft-packager
fyne package -src ./cmd/dungeondraft-packager --release -appID io.github.ryex.dungondraft-gopackager
- name: Build gui
if: ${{ runner.os != 'Windows' }}
run: |
cp FyneApp.toml ./cmd/dungeondraft-packager
fyne package -src ./cmd/dungeondraft-packager --release -appID io.github.ryex.dungondraft-gopackager
- name: Build cli (windows)
if: ${{ runner.os == 'Windows' }}
# shell: msys2 {0}
run: |
# export GOROOT=/ucrt64/lib/go
# export GOPATH=/ucrt64
go build -ldflags "-s -w" ./cmd/dungeondraft-packager-cli
- name: Build cli
if: ${{ runner.os != 'Windows' }}
run: |
go build -ldflags "-s -w" ./cmd/dungeondraft-packager-cli
- name: List dir
run: |
ls .
ls ./cmd/dungeondraft-packager
- name: Prep artifacts (windows)
if: ${{ runner.os == 'windows' }}
# shell: msys2 {0}
run: |
mkdir install
cp "./cmd/dungeondraft-packager/Dungeondraft GoPackager.exe" ./install
cp "./dungeondraft-packager-cli.exe" ./install
cp *.md ./install
# cp /ucrt64/bin/libwebp-*.dll ./install
# cp /ucrt64/bin/libsharpyuv-*.dll ./install
ls -r ./install
# ldd "./install/Dungeondraft GoPackager.exe"
# dumpbin /dependents "./install/Dungeondraft GoPackager.exe"
- name: Prep artifacts (linux)
if: ${{ runner.os == 'Linux' }}
run: |
mkdir install
tar -xJf "./Dungeondraft GoPackager.tar.xz" -C ./install
cp ./dungeondraft-packager* ./install/usr/local/bin
sed -i "/install:/install:\n\tinstall -Dm00644 usr/local/bin/$$(Exec)-cli $$(DESTDIR)$$(PREFIX)/bin/$$(Exec)-cli" ./install/Makefile
cp *.md ./install
ls -r ./install
ldd ./install/usr/local/bin/dungeondraft-packager
- name: Prep artifacts (maOS)
if: ${{ runner.os == 'macOS' }}
run: |
mkdir install
cp -r "./Dungeondraft GoPackager.app" ./install
cp ./dungeondraft-packager* ./install
cp *.md ./install
mkdir "./install/Dungeondraft GoPackager.app/Contents/Frameworks"
# cp /opt/homebrew/opt/webp/lib/libwebp.7.dylib "./install/Dungeondraft GoPackager.app/Contents/Frameworks"
# install_name_tool -change /opt/homebrew/opt/webp/lib/libwebp.7.dylib "@executable_path/../Frameworks/libwebp.7.dylib" "./install/Dungeondraft GoPackager.app/Contents/MacOS/dungeondraft-packager"
ls ./install
ls -r "./install/Dungeondraft GoPackager.app"
otool -L "./install/Dungeondraft GoPackager.app/Contents/MacOS/dungeondraft-packager"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Dungeondraft-GoPackager-${{ runner.os }}
path: install/**
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: List dir
run: ls
- name: Package
run: |
pushd Dungeondraft-GoPackager-Linux ; tar -czf ../Dungeondraft-GoPackager-Linux.tar.gz * ; popd
pushd Dungeondraft-GoPackager-macOS ; zip -r ../Dungeondraft-GoPackager-macOS.zip * ; popd
pushd Dungeondraft-GoPackager-Windows ; zip -r ../Dungeondraft-GoPackager-Windows.zip * ; popd
- name: Release
uses: softprops/action-gh-release@v2
with:
body_path: Dungeondraft-GoPackager-Linux/CHANGELOG.md
draft: true
files: |
Dungeondraft-GoPackager-Linux.tar.gz
Dungeondraft-GoPackager-macOS.zip
Dungeondraft-GoPackager-Windows.zip