-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (174 loc) · 5.78 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
name: Build twipo-synchro
on:
push:
release:
types: [published]
workflow_dispatch:
jobs:
build-installer-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build installer
run: |
cargo build --release --target i686-pc-windows-msvc --bin installer
- name: Upload
uses: actions/upload-artifact@v4
with:
name: installer-windows-${{ github.sha }}
path: ./target/i686-pc-windows-msvc/release/installer.exe
build-installer-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install i686 target
run: |
rustup target add i686-unknown-linux-musl
- name: Build installer
run: |
cargo build --release --target i686-unknown-linux-musl --bin installer
- name: Upload
uses: actions/upload-artifact@v4
with:
name: installer-linux-${{ github.sha }}
path: ./target/i686-unknown-linux-musl/release/installer
build-lb:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/cache@v3
with:
path: |
~/AppData/Roaming/vcpkg/archives
~/AppData/Local/vcpkg/archives
key: ${{ runner.os }}-vcpkg
- name: Setup MSBuild
uses: microsoft/[email protected]
- name: Build LanguageBarrier
run: |
cd LanguageBarrier
vcpkg install minhook cereal nlohmann-json freetype directxtex --triplet=x86-windows-static-md
vcpkg integrate install
msbuild /p:"Configuration=dinput8-Release;VcpkgUserTriplet=x86-windows-static-md;VcpkgUseStatic=false"
- name: Upload
uses: actions/upload-artifact@v4
with:
name: lb-${{ github.sha }}
path: ./LanguageBarrier/dinput8-Release/dinput8.dll
build-server:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build server
run: |
cargo build --release --target i686-pc-windows-msvc --bin twipo-synchro
- name: Upload
uses: actions/upload-artifact@v4
with:
name: server-${{ github.sha }}
path: ./target/i686-pc-windows-msvc/release/twipo-synchro.exe
generate-about:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-about
- name: Install cargo-about
continue-on-error: true
run: |
cargo install cargo-about
- name: Generate third party license file for the server
run: |
cargo about generate about.hbs > thirdparty.LICENSE.md
- name: Upload
uses: actions/upload-artifact@v4
with:
name: about-${{ github.sha }}
path: ./thirdparty.LICENSE.md
pack-dist:
runs-on: windows-latest
needs: [build-installer-win, build-installer-linux, build-lb, build-server, generate-about]
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Prepare dist
run: |
mkdir "dist"
mkdir "dist/twipo-synchro"
mkdir "dist/NOTES ELITE"
copy "installer-windows-${{ github.sha }}/installer.exe" "dist/installer-win.exe"
copy "installer-linux-${{ github.sha }}/installer" "dist/installer-linux"
copy "README.md" "dist/"
copy "server-${{ github.sha }}/twipo-synchro.exe" "dist/twipo-synchro"
copy "LICENSE" "dist/twipo-synchro"
copy "res/charset.LICENSE.md" "dist/twipo-synchro"
copy "about-${{ github.sha }}/thirdparty.LICENSE.md" "dist/twipo-synchro"
copy "lb-${{ github.sha }}/dinput8.dll" "dist/NOTES ELITE"
copy "LanguageBarrier/LanguageBarrier/LICENSE" "dist/NOTES ELITE"
copy "LanguageBarrier/LanguageBarrier/THIRDPARTY.LB.txt" "dist/NOTES ELITE"
- name: Create dist zip
run: |
mv dist "twipo-synchro-${{ github.ref_name }}"
Compress-Archive -Path "twipo-synchro-${{ github.ref_name }}" -DestinationPath "twipo-synchro-${{ github.ref_name }}.zip"
- name: Upload
uses: actions/upload-artifact@v4
with:
name: "twipo-synchro-${{ github.sha }}"
path: "twipo-synchro-${{ github.ref_name }}"
- name: Update release
if: github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'created')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: "./twipo-synchro-${{ github.ref_name }}.zip"
asset_name: "twipo-synchro-${{ github.ref_name }}.zip"
asset_content_type: application/zip