-
Notifications
You must be signed in to change notification settings - Fork 8
97 lines (93 loc) · 3.22 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
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: 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: Install Build Deps (Linux)
if: ${{ runner.os == 'linux' }}
run: sudo apt-get install golang gcc libgl1-mesa-dev xorg-dev
- name: Install Fyne
run: go install fyne.io/fyne/v2/cmd/fyne@latest
- name: install go deps
run: go mod download
- name: Build gui
run: |
fyne package -src ./cmd/dungeondraft-packager -appID io.github.ryex.dungondraft-gopackager
- name: Build cli
run: |
go build -ldflags "-s -w" ./cmd/dungeondraft-packager-cli
- name: Prep artifacts (windows)
if: ${{ runner.os == 'windows' }}
run: |
mv cmd/dungeondraft-packager/dungeondraft-packager.exe .
- name: List dir
run: ls
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Dungeondraft-GoPackager-${{ runner.os }}
path: |
dungeondraft-packager*
README.md
LICENSE.md
CHANGELOG.md
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Grab and store version
run: |
tag_name=$(echo ${{ github.ref }} | grep -oE "[^/]+$")
echo "VERSION=$tag_name" >> $GITHUB_ENV
- name: List dir
run: ls
- name: Package
run: |
pushd Dungeondraft-GoPackager-Linux ; tar -czf ../Dungeondraft-GoPackager-Linux-${{ env.VERSION }}.tar.gz * ; popd
pushd Dungeondraft-GoPackager-macOS ; zip -r ../Dungeondraft-GoPackager-macOS-${{ env.VERSION }}.zip * ; popd
pushd Dungeondraft-GoPackager-Windows ; zip -r ../Dungeondraft-GoPackager-Windows-${{ env.VERSION }}.zip * ; popd
- name: Release
uses: softprops/action-gh-release@v2
with:
body_path: Dungeondraft-GoPackager-Linux/CHANGELOG.md
draft: true
files: |
Dungeondraft-GoPackager-Linux-${{ env.VERSION }}.tar.gz
Dungeondraft-GoPackager-macOS-${{ env.VERSION }}.zip
Dungeondraft-GoPackager-Windows-${{ env.VERSION }}.zip