-
Notifications
You must be signed in to change notification settings - Fork 166
203 lines (200 loc) · 6.97 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
name: Build
permissions:
contents: write
on:
push:
branches:
- main
tags:
- 'v*'
jobs:
changelog:
name: Generate changelog
runs-on: ubuntu-latest
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@v2
id: git-cliff
with:
config: cliff.toml
args: -vv --latest --strip header
env:
OUTPUT: CHANGELOG.md
- name: Print the changelog
run: cat "${{ steps.git-cliff.outputs.changelog }}"
build-windows:
runs-on: windows-latest
needs: changelog
strategy:
matrix:
cpu: [ x64, x86 ]
kind: [ zip ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
- name: Read Version Text
id: version
uses: juliangruber/read-file-action@v1
with:
path: version.txt
- name: Install Pupnet
run: |
dotnet tool install -g KuiperZone.PupNet
- name: Get Deps
run: |
.\ffmpeg.ps1 ${{ matrix.cpu }}
.\aria2.ps1 ${{ matrix.cpu }}
working-directory: ./script
- name: Package
run: |
pupnet DownKyi.pupnet.conf --app-version ${{ steps.version.outputs.content }} --kind ${{ matrix.kind }} -r win-${{ matrix.cpu }} -y
working-directory: ./script/pupnet
- name: Upload build artifacts ${{ matrix.kind }}
uses: actions/upload-artifact@v3
with:
name: DownKyi-${{ steps.version.outputs.content }}-1.win-${{ matrix.cpu }}.${{ matrix.kind }}
path: script/pupnet/output/DownKyi-${{ steps.version.outputs.content }}-1.win-${{ matrix.cpu }}.${{ matrix.kind }}
- name: Release
uses: ncipollo/release-action@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
allowUpdates: true
artifacts: script/pupnet/output/DownKyi-${{ steps.version.outputs.content }}-1.win-${{ matrix.cpu }}.${{ matrix.kind }}
body: ${{ needs.changelog.outputs.release_body }}
build-linux:
runs-on: ubuntu-latest
needs: changelog
strategy:
matrix:
cpu: [ x64 ]
kind: [ AppImage, deb, rpm ]
type: [ self-contained ]
include:
- kind: AppImage
cpu: x64
package-tail: .x86_64
package-head: DownKyi-
- kind: deb
cpu: x64
package-tail: _amd64
package-head: downkyi_
- kind: rpm
cpu: x64
package-tail: .x86_64
package-head: downkyi_
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
- name: Read Version Text
id: version
uses: juliangruber/read-file-action@v1
with:
path: version.txt
- name: Install Pupnet
run: |
dotnet tool install -g KuiperZone.PupNet
sudo apt update
sudo apt install libfuse2
- name: Get Deps
run: |
chmod +x ffmpeg.sh
chmod +x aria2.sh
./ffmpeg.sh linux ${{ matrix.cpu }}
./aria2.sh linux-${{ matrix.cpu }}
working-directory: ./script
- name: Package
run: |
pupnet DownKyi.pupnet.conf --app-version ${{ steps.version.outputs.content }} --kind ${{ matrix.kind }} -r linux-${{ matrix.cpu }} -y
working-directory: ./script/pupnet
- name: Upload build artifacts ${{ matrix.kind }}
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.package-head }}${{ steps.version.outputs.content }}_linux_${{ matrix.type }}${{ matrix.package-tail }}.${{ matrix.kind }}
path: script/pupnet/output/${{ matrix.package-head }}${{ steps.version.outputs.content }}-1${{ matrix.package-tail }}.${{ matrix.kind }}
- name: Change Name
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: mv "${{ matrix.package-head }}${{ steps.version.outputs.content }}-1${{ matrix.package-tail }}.${{ matrix.kind }}" "${{ matrix.package-head }}${{ steps.version.outputs.content }}_linux_${{ matrix.type }}${{ matrix.package-tail }}.${{ matrix.kind }}"
working-directory: ./script/pupnet/output/
- name: Release
uses: ncipollo/release-action@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
allowUpdates: true
artifacts: script/pupnet/output/${{ matrix.package-head }}${{ steps.version.outputs.content }}_linux_${{ matrix.type }}${{ matrix.package-tail }}.${{ matrix.kind }}
body: ${{ needs.changelog.outputs.release_body }}
build-macos:
runs-on: macos-latest
needs: changelog
strategy:
matrix:
cpu: [ x64, arm64 ]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Tool Via HomeBrew
run: |
export HOMEBREW_NO_AUTO_UPDATE=true
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=true
brew install create-dmg tree
- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
- name: Read Version Text
id: version
uses: juliangruber/read-file-action@v1
with:
path: version.txt
- name: Get Deps
run: |
chmod +x ffmpeg.sh
./ffmpeg.sh mac ${{ matrix.cpu }}
working-directory: ./script
- name: Build ${{ matrix.cpu }}
run: |
dotnet restore
dotnet publish --self-contained -r osx-${{ matrix.cpu }} -c Release -p:DebugType=None -p:DebugSymbols=false
- name: Package app
run: |
chmod +x package.sh
./package.sh ${{ matrix.cpu }}
working-directory: ./script/macos
- name: Create DMG
run: |
create-dmg \
--hdiutil-quiet \
--icon 哔哩下载姬.app 165 175 \
--icon-size 120 \
--app-drop-link 495 175 \
--window-size 660 400 \
DownKyi-${{ steps.version.outputs.content }}-osx-${{ matrix.cpu }}.dmg 哔哩下载姬.app
working-directory: ./script/macos
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: DownKyi-${{ steps.version.outputs.content }}-osx-${{ matrix.cpu }}.dmg
path: script/macos/DownKyi-${{ steps.version.outputs.content }}-osx-${{ matrix.cpu }}.dmg
- name: Release
uses: ncipollo/release-action@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
allowUpdates: true
artifacts: script/macos/DownKyi-${{ steps.version.outputs.content }}-osx-${{ matrix.cpu }}.dmg
body: ${{ needs.changelog.outputs.release_body }}