-
Notifications
You must be signed in to change notification settings - Fork 43
144 lines (131 loc) · 5.4 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
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
name: Release
on:
push:
tags:
- '*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
label: 'ubuntu'
- os: windows-latest
label: 'windows'
- os: macos-latest
label: 'macos-arm'
- os: macos-13
label: 'macos-x86'
runs-on: ${{ matrix.os }}
env:
LPAC_VERSION: v2.2.0+0b81e8a
LPAC_VERSION_IN_URL: v2.2.0%2B0b81e8a
LPAC_REPO: https://github.com/creamlike1024/lpac
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" == "macOS" ]]; then
sed -i '' "s/const Version = \"development\"/const Version = \"$VERSION\"/" main.go
sed -i '' "s/const EUICCDataVersion = \"unknown\"/const EUICCDataVersion = \"$DATE\"/" main.go
else
sed -i "s/const Version = \"development\"/const Version = \"$VERSION\"/" main.go
sed -i "s/const EUICCDataVersion = \"unknown\"/const EUICCDataVersion = \"$DATE\"/" main.go
fi
shell: bash
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: '1.20'
- 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
- name: Setup msys2
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
install: git mingw-w64-x86_64-toolchain wget zip unzip
path-type: inherit
- name: Build for Linux
if: runner.os == 'Linux'
run: |
go install fyne.io/fyne/v2/cmd/fyne@latest
go generate
go build -ldflags="-s -w"
wget $LPAC_REPO/releases/download/$LPAC_VERSION_IN_URL/lpac-linux-x86_64.zip -O lpac.zip
unzip lpac.zip && rm lpac.zip
wget $LPAC_REPO/archive/refs/tags/$LPAC_VERSION_IN_URL.tar.gz -O lpac-$LPAC_VERSION-src.tar.gz
chmod +x EasyLPAC lpac
tar zcf EasyLPAC-linux-x86_64-with-lpac.tar.gz EasyLPAC lpac lpac-$LPAC_VERSION-src.tar.gz LICENSE LICENSE-lpac
tar zcf EasyLPAC-linux-x86_64.tar.gz EasyLPAC lpac-$LPAC_VERSION-src.tar.gz LICENSE LICENSE-lpac
- name: Build for Windows
if: runner.os == 'Windows'
run: |
go install fyne.io/fyne/v2/cmd/fyne@latest
go generate
fyne package --icon assets/icon64.png
mkdir easylpac && cp EasyLPAC.exe easylpac && cd easylpac
wget $LPAC_REPO/releases/download/$LPAC_VERSION_IN_URL/lpac-windows-x86_64-mingw.zip -O lpac.zip
unzip lpac.zip && rm lpac.zip
rm LICENSE* *.md
wget $LPAC_REPO/archive/refs/tags/$LPAC_VERSION_IN_URL.zip -O lpac-$LPAC_VERSION-src.zip
wget $LPAC_REPO/raw/main/src/LICENSE -O LICENSE-lpac
cp $GITHUB_WORKSPACE/LICENSE ./
zip -r $GITHUB_WORKSPACE/EasyLPAC-windows-x86_64-with-lpac.zip ./*
shell: msys2 {0}
- name: Build for macOS ARM
if: matrix.label == 'macos-arm'
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 $LPAC_REPO/releases/download/$LPAC_VERSION_IN_URL/lpac-darwin-universal.zip -O lpac.zip
unzip lpac.zip && rm lpac.zip
rm LICENSE* *.md
cd $GITHUB_WORKSPACE
wget $LPAC_REPO/archive/refs/tags/$LPAC_VERSION_IN_URL.zip -O lpac-$LPAC_VERSION-src.zip
wget $LPAC_REPO/raw/main/src/LICENSE -O LICENSE-lpac
zip -r EasyLPAC-macOS-arm64-with-lpac.zip EasyLPAC.app lpac-$LPAC_VERSION-src.zip LICENSE*
- name: Build for macOS x86
if: matrix.label == 'macos-x86'
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 $LPAC_REPO/releases/download/$LPAC_VERSION_IN_URL/lpac-darwin-universal.zip -O lpac.zip
unzip lpac.zip && rm lpac.zip
rm LICENSE* *.md
cd $GITHUB_WORKSPACE
wget $LPAC_REPO/archive/refs/tags/$LPAC_VERSION_IN_URL.zip -O lpac-$LPAC_VERSION-src.zip
wget $LPAC_REPO/raw/main/src/LICENSE -O LICENSE-lpac
zip -r EasyLPAC-macOS-x86_64-with-lpac.zip EasyLPAC.app lpac-$LPAC_VERSION-src.zip LICENSE*
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: build-artifact-${{ matrix.label }}
path: |
EasyLPAC-windows-x86_64-with-lpac.zip
EasyLPAC-macOS-arm64-with-lpac.zip
EasyLPAC-macOS-x86_64-with-lpac.zip
EasyLPAC-linux-x86_64-with-lpac.tar.gz
EasyLPAC-linux-x86_64.tar.gz
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
EasyLPAC-windows-x86_64-with-lpac.zip
EasyLPAC-macOS-arm64-with-lpac.zip
EasyLPAC-macOS-x86_64-with-lpac.zip
EasyLPAC-linux-x86_64-with-lpac.tar.gz
EasyLPAC-linux-x86_64.tar.gz