-
Notifications
You must be signed in to change notification settings - Fork 38
113 lines (101 loc) · 4.1 KB
/
release.yaml
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
name: Release
on:
push:
tags:
- '*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Modify version number
run: |
VERSION=$(grep 'Version' FyneApp.toml | sed 's/Version = "\(.*\)"/\1/' | xargs)
DATE=$(TZ=Asia/Shanghai date +"%Y-%m-%d")
if [[ "$RUNNER_OS" == "Linux" ]]; then
sed -i "s/const Version = \"development\"/const Version = \"$VERSION\"/" main.go
sed -i "s/const EUICCDataVersion = \"unknown\"/const EUICCDataVersion = \"$DATE\"/" main.go
elif [[ "$RUNNER_OS" == "macOS" ]]; then
sed -i '' "s/const Version = \"development\"/const Version = \"$VERSION\"/" main.go
sed -i '' "s/const EUICCDataVersion = \"unknown\"/const EUICCDataVersion = \"$DATE\"/" main.go
fi
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: '>=1.21.0'
- name: Setup Docker
if: runner.os == 'Linux'
uses: docker-practice/actions-setup-docker@master
- name: Setup toolchain
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y build-essential libgl1-mesa-dev xorg-dev libgtk-3-dev
go install fyne.io/fyne/v2/cmd/fyne@latest
go install github.com/fyne-io/fyne-cross@latest
# - name: Build for Linux
# if: runner.os == 'Linux'
# run: |
# go build -ldflags="-s -w"
# mkdir lpac
# chmod +x EasyLPAC
# tar zcf EasyLPAC-linux-x86_64.tar.gz EasyLPAC lpac
- name: Build for Windows
if: runner.os == 'Linux'
run: |
go generate
fyne-cross windows --arch=amd64,arm64 --icon assets/icon64.png
cd fyne-cross/bin/windows-amd64
wget https://github.com/estkme-group/lpac/releases/download/v2.0.0/lpac-windows-x86_64-mingw.zip -O lpac.zip
unzip lpac.zip
rm lpac.zip
zip -r $GITHUB_WORKSPACE/EasyLPAC-windows-x86_64-with-lpac.zip ./*
cd $GITHUB_WORKSPACE/fyne-cross/bin/windows-arm64
wget https://github.com/estkme-group/lpac/releases/download/v2.0.0/lpac-windows-arm64-mingw.zip -O lpac.zip
unzip lpac.zip
rm lpac.zip
zip -r $GITHUB_WORKSPACE/EasyLPAC-windows-arm64-with-lpac.zip ./*
- name: Build for macOS
if: runner.os == 'macOS'
run: |
go install fyne.io/fyne/v2/cmd/fyne@latest
go generate
fyne package --icon assets/icon128.png --release
cd EasyLPAC.app/Contents/MacOS
wget https://github.com/estkme-group/lpac/releases/download/v2.0.0/lpac-darwin-universal.zip -O lpac.zip
unzip lpac.zip && rm lpac.zip
cd $GITHUB_WORKSPACE
zip -r EasyLPAC-macOS-x86_64-with-lpac.zip EasyLPAC.app
mkdir dmg && cp -r EasyLPAC.app dmg
hdiutil create -volname "EasyLPAC" -srcfolder dmg -ov -format UDRW EasyLPAC.dmg
hdiutil attach EasyLPAC.dmg
cp assets/icon.icns /Volumes/EasyLPAC/.VolumeIcon.icns
SetFile -c icnC /Volumes/EasyLPAC/.VolumeIcon.icns
SetFile -a C /Volumes/EasyLPAC
hdiutil detach /Volumes/EasyLPAC
hdiutil convert EasyLPAC.dmg -format UDZO -o EasyLPAC-macOS-x86_64-with-lpac.dmg
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: build-artifact-${{ matrix.os }}
path: |
EasyLPAC-windows-x86_64-with-lpac.zip
EasyLPAC-windows-arm64-with-lpac.zip
EasyLPAC-macOS-x86_64-with-lpac.zip
EasyLPAC-macOS-x86_64-with-lpac.dmg
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
EasyLPAC-windows-x86_64-with-lpac.zip
EasyLPAC-windows-arm64-with-lpac.zip
EasyLPAC-macOS-x86_64-with-lpac.zip
EasyLPAC-macOS-x86_64-with-lpac.dmg