-
-
Notifications
You must be signed in to change notification settings - Fork 119
209 lines (183 loc) · 7.27 KB
/
publish_release.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
name: Release
on:
workflow_dispatch:
inputs:
tag:
required: true
description: 'Release Tag'
status:
required: true
description: 'Release Status (beta, stable)'
env:
BUILD_TYPE: Release
jobs:
build:
name: Build
runs-on: windows-2022
steps:
- name: Checkout repository
uses: actions/[email protected]
with:
fetch-depth: 1
submodules: 'true'
- name: Create tag
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git tag | xargs git tag -d
git tag ${{ github.event.inputs.tag }}
git push origin ${{ github.event.inputs.tag }}
shell: bash
- name: Cache BDS libraries
id: cache-bds-lib
uses: actions/cache@v3
env:
cache-name: cache-bds-lib
with:
path: |
${{ env.GITHUB_WORKSPACE }}LiteLoader/Lib/bedrock_server_api.lib
${{ env.GITHUB_WORKSPACE }}LiteLoader/Lib/bedrock_server_var.lib
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('scripts/LINK.txt') }}
- name: Download BDS if not cached
if: steps.cache-bds-lib.outputs.cache-hit != 'true'
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
mkdir Tools/Server
ServerLink=$(cat 'scripts/LINK.txt')
curl -L -o Tools/Server/server.zip "$ServerLink"
unzip Tools/Server/server.zip -d Tools/Server/ > /dev/null
shell: bash
- name: Build libraries if not cached
if: steps.cache-bds-lib.outputs.cache-hit != 'true'
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
mkdir LiteLoader/lib
cd tools
./PeEditor.exe -l --pdb Server/bedrock_server.pdb -o ../LiteLoader/lib
shell: bash
- name: Set LITELOADER_VERSION_COMMIT_SHA
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
export sha_short=$(git rev-parse --short HEAD)
sed -r -i "s/#define\s+LITELOADER_VERSION_COMMIT_SHA\s+.*/#define LITELOADER_VERSION_COMMIT_SHA $sha_short\r/" LiteLoader/include/liteloader/Version.h
shell: bash
- name: Set LITELOADER_VERSION_STATUS_BETA
working-directory: ${{ env.GITHUB_WORKSPACE }}
if: github.event.inputs.status == 'beta'
run: |
sed -r -i 's/#define\s+LITELOADER_VERSION_STATUS\s+LITELOADER_VERSION_\w+/#define LITELOADER_VERSION_STATUS LITELOADER_VERSION_BETA/' LiteLoader/include/liteloader/Version.h
shell: bash
- name: Set LITELOADER_VERSION_STATUS_RELEASE
working-directory: ${{ env.GITHUB_WORKSPACE }}
if: github.event.inputs.status == 'stable'
run: |
sed -r -i 's/#define\s+LITELOADER_VERSION_STATUS\s+LITELOADER_VERSION_\w+/#define LITELOADER_VERSION_STATUS LITELOADER_VERSION_RELEASE/' LiteLoader/include/liteloader/Version.h
shell: bash
- name: Configure CMake (MSVC)
run: |
cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
shell: cmd
- name: Build all
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
shell: cmd
- name: Pack output
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target PackOutput
shell: cmd
- name: Pack SDK
run: |
cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --target PackSDK
shell: cmd
- name: Configure CMake (ClangCL)
run: |
cmake -B ${{github.workspace}}/build_clang -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -T clangcl
shell: cmd
- name: Build SymDBHelper
run: |
cmake --build ${{github.workspace}}/build_clang --config ${{env.BUILD_TYPE}} --target SymDBHelper
cp .\build_clang\sdk\lib\SymDBHelper.lib .\build\sdk\lib\SymDBHelper.lib
- name: Compress resource packs for LiteLoaderBDS
run: |
cd build/output/plugins/LiteLoader/ResourcePacks
7z a LiteLoaderBDS-CUI.tar LiteLoaderBDS-CUI
rm -r LiteLoaderBDS-CUI
shell: bash
- name: Download Dependencies
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
mkdir LL-Dependencies
git clone https://github.com/Tooth-Hub/LLMoney.git LL-Dependencies/LLMoney-bin
cp LL-Dependencies/LLMoney-bin/LLMoney.dll build/output/plugins/
git clone https://github.com/Tooth-Hub/CrashLogger.git LL-Dependencies/CrashLogger-bin
cp LL-Dependencies/CrashLogger-bin/CrashLogger.exe build/output/plugins/LiteLoader/
cp LL-Dependencies/CrashLogger-bin/*.dll build/output/plugins/LiteLoader/
git clone https://github.com/Tooth-Hub/PeEditor.git LL-Dependencies/PeEditor-bin
cp LL-Dependencies/PeEditor-bin/PeEditor.exe build/output/
shell: bash
- name: Update C++ SDK
working-directory: ${{ env.GITHUB_WORKSPACE }}
run: |
mkdir ~/.ssh
touch ~/.ssh/known_hosts
ssh-keygen -R github.com
curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | sed -e 's/^/github.com /' >> ~/.ssh/known_hosts
echo "-----BEGIN OPENSSH PRIVATE KEY-----" >> ~/.ssh/id_rsa
echo ${{secrets.DEPLOY_KEY}} >> ~/.ssh/id_rsa
echo "-----END OPENSSH PRIVATE KEY-----" >> ~/.ssh/id_rsa
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
cd scripts
cmd //c "UpdateSDK.cmd action release"
shell: bash
- name: Upload LiteLoaderBDS
uses: actions/[email protected]
with:
name: LiteLoaderBDS
path: |
${{ github.workspace }}\build\output\
- name: Upload PDB files
uses: actions/[email protected]
with:
name: PDB
path: ${{ github.workspace }}\build\pdb\
publish_release:
name: Publish release
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: build/
- name: Pack artifacts
run: |
cd build/
zip -9r LiteLoaderBDS.zip LiteLoaderBDS/*
zip -9r PDB.zip PDB/*
shell: bash
- name: Create release
if: github.event.inputs.status == 'stable'
uses: ncipollo/release-action@v1
with:
prerelease: false
tag: ${{ github.event.inputs.tag }}
artifacts: |
build/LiteLoaderBDS.zip
build/PDB.zip
env:
GITHUB_REPOSITORY: LiteLDev/LiteLoaderBDS
- name: Create pre-release
if: github.event.inputs.status != 'stable'
uses: ncipollo/release-action@v1
with:
prerelease: true
tag: ${{ github.event.inputs.tag }}
artifacts: |
build/LiteLoaderBDS.zip
build/PDB.zip
env:
GITHUB_REPOSITORY: LiteLDev/LiteLoaderBDS