-
Notifications
You must be signed in to change notification settings - Fork 7
211 lines (183 loc) · 7.85 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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Build
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
name: ${{ matrix.target.rid }}
strategy:
fail-fast: false
matrix:
target:
- goos: windows
rid: win-x64
os: windows-2022
- goos: linux
rid: linux-x64
os: ubuntu-20.04
- goos: darwin
rid: osx-x64
os: macos-11
runs-on: ${{ matrix.target.os }}
env:
GOOS: ${{ matrix.target.goos }}
GOARCH: amd64
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Prepare Tag
id: tag
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION="${GITHUB_REF##refs/tags/}"
BUILD_VERSION="${VERSION:1}"
BUILD_NUMBER="$(git rev-list HEAD --count)"
echo "Found Tag: ${VERSION}"
echo "Build Version: ${BUILD_VERSION}"
echo "Build Number: ${BUILD_NUMBER}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "build_version=${BUILD_VERSION}" >> $GITHUB_OUTPUT
echo "build_number=${BUILD_NUMBER}" >> $GITHUB_OUTPUT
shell: bash
- name: Draft Release
if: matrix.target.goos == 'linux' && startsWith(github.ref, 'refs/tags/')
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }}
run: |
gh release create ${{ steps.tag.outputs.version }} -d
shell: bash
- name: Cache Build Caches
uses: actions/cache@v3
with:
path: build/caches/
key: koi-${{ runner.os }}-${{ hashFiles('config.ts') }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: yarn
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ~1.19.0
cache: true
cache-dependency-path: config.ts
- name: Install Dependencies (macOS)
if: matrix.target.goos == 'darwin'
run: brew install graphicsmagick imagemagick
shell: bash
- name: Install Dependencies (Linux)
if: matrix.target.goos == 'linux'
run: |
sudo apt update
sudo apt install -y fuse libfuse2
shell: bash
- name: Install Build Package
run: |
yarn install --frozen-lockfile
shell: bash
- name: Build Koi
run: |
yarn gulp ciBuild
shell: bash
- name: Upload zip for Windows to Build Artifact
if: matrix.target.goos == 'windows'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.zip
path: build/dist/koishi.zip
- name: Upload msi for Windows to Build Artifact
if: matrix.target.goos == 'windows'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.msi
path: build/dist/koishi.msi
- name: Upload zip for macOS to Build Artifact
if: matrix.target.goos == 'darwin'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.zip
path: build/dist/koishi.zip
- name: Upload dmg for macOS to Build Artifact
if: matrix.target.goos == 'darwin'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.dmg
path: build/dist/koishi.dmg
- name: Upload pkg for macOS to Build Artifact
if: matrix.target.goos == 'darwin'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.pkg
path: build/dist/koishi.pkg
- name: Upload zip for Linux to Build Artifact
if: matrix.target.goos == 'linux'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.zip
path: build/dist/koishi.zip
- name: Upload AppImage for Linux to Build Artifact
if: matrix.target.goos == 'linux'
uses: actions/upload-artifact@v3
with:
name: koi-${{ matrix.target.rid }}-${{ github.sha }}.AppImage
path: build/dist/Koishi.AppImage
- name: Upload Release Files for Windows to GitHub Release
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'windows'
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }}
run: |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/koishi.msi build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi
gh release upload ${{ steps.tag.outputs.version }} \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi
shell: bash
- name: Upload Release Files for macOS to GitHub Release
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'darwin'
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }}
run: |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/koishi.dmg build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.dmg
mv build/dist/koishi.pkg build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg
gh release upload ${{ steps.tag.outputs.version }} \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.dmg \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg
shell: bash
- name: Upload Release Files for Linux to GitHub Release
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'linux'
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }}
run: |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/Koishi.AppImage build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.AppImage
gh release upload ${{ steps.tag.outputs.version }} \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.AppImage
shell: bash
- name: Upload Release Files for Windows to App Center
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'windows'
run: |
yarn appcenter distribute release --disable-telemetry -t 1000000 \
--token ${{ secrets.APPCENTER_DEPLOY_KEY }} \
-a koishi/Koishi-Desktop-for-Windows \
-g stable \
-b ${{ steps.tag.outputs.build_version }} \
-f build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.msi
shell: bash
- name: Upload Release Files for macOS to App Center
if: startsWith(github.ref, 'refs/tags/') && matrix.target.goos == 'darwin'
run: |
yarn appcenter distribute release --disable-telemetry -t 1000000 \
--token ${{ secrets.APPCENTER_DEPLOY_KEY }} \
-a koishi/Koishi-Desktop-for-macOS \
-g stable \
-b ${{ steps.tag.outputs.build_version }} -n ${{ steps.tag.outputs.build_number }} \
-f build/dist/koishi-desktop-${{ matrix.target.rid }}-${{ steps.tag.outputs.version }}.pkg
shell: bash