-
Notifications
You must be signed in to change notification settings - Fork 7
177 lines (151 loc) · 6.6 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:
pull_request:
workflow_dispatch:
jobs:
build:
name: ${{ fromJson(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: ${{ fromJson(matrix.target).os }}
env:
GOOS: ${{ fromJson(matrix.target).goos }}
GOARCH: amd64
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 0
- name: Prepare Tag
id: tag
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION="${GITHUB_REF##refs/tags/}"
echo "Found Tag: ${VERSION}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
shell: bash
- name: Draft Release
if: fromJson(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@v3
with:
node-version: '18'
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: fromJson(matrix.target).goos == 'darwin'
run: brew install graphicsmagick imagemagick
shell: bash
- name: Install Dependencies (Linux)
if: fromJson(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
if: fromJson(matrix.target).goos == 'windows'
uses: actions/upload-artifact@v3
with:
name: koi-${{ fromJson(matrix.target).rid }}-${{ github.sha }}.zip
path: build/dist/koishi.zip
- name: Upload msi for Windows
if: fromJson(matrix.target).goos == 'windows'
uses: actions/upload-artifact@v3
with:
name: koi-${{ fromJson(matrix.target).rid }}-${{ github.sha }}.msi
path: build/dist/koishi.msi
- name: Upload zip for macOS
if: fromJson(matrix.target).goos == 'darwin'
uses: actions/upload-artifact@v3
with:
name: koi-${{ fromJson(matrix.target).rid }}-${{ github.sha }}.zip
path: build/dist/koishi.zip
- name: Upload dmg for macOS
if: fromJson(matrix.target).goos == 'darwin'
uses: actions/upload-artifact@v3
with:
name: koi-${{ fromJson(matrix.target).rid }}-${{ github.sha }}.dmg
path: build/dist/koishi.dmg
- name: Upload pkg for macOS
if: fromJson(matrix.target).goos == 'darwin'
uses: actions/upload-artifact@v3
with:
name: koi-${{ fromJson(matrix.target).rid }}-${{ github.sha }}.pkg
path: build/dist/koishi.pkg
- name: Upload zip for Linux
if: fromJson(matrix.target).goos == 'linux'
uses: actions/upload-artifact@v3
with:
name: koi-${{ fromJson(matrix.target).rid }}-${{ github.sha }}.zip
path: build/dist/koishi.zip
- name: Upload AppImage for Linux
if: fromJson(matrix.target).goos == 'linux'
uses: actions/upload-artifact@v3
with:
name: koi-${{ fromJson(matrix.target).rid }}-${{ github.sha }}.AppImage
path: build/dist/Koishi.AppImage
- name: Upload Release Files for Windows
if: startsWith(github.ref, 'refs/tags/') && fromJson(matrix.target).goos == 'windows'
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }}
run: |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/koishi.msi build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.msi
gh release upload ${{ steps.tag.outputs.version }} \
build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.msi
shell: bash
- name: Upload Release Files for macOS
if: startsWith(github.ref, 'refs/tags/') && fromJson(matrix.target).goos == 'darwin'
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }}
run: |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/koishi.dmg build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.dmg
mv build/dist/koishi.pkg build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.pkg
gh release upload ${{ steps.tag.outputs.version }} \
build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.dmg \
build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.pkg
shell: bash
- name: Upload Release Files for Linux
if: startsWith(github.ref, 'refs/tags/') && fromJson(matrix.target).goos == 'linux'
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_DEPLOY_MODULE_KEY }}
run: |
mv build/dist/koishi.zip build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.zip
mv build/dist/Koishi.AppImage build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.AppImage
gh release upload ${{ steps.tag.outputs.version }} \
build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.zip \
build/dist/koishi-desktop-${{ fromJson(matrix.target).rid }}-${{ steps.tag.outputs.version }}.AppImage
shell: bash