style: update version #3555
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
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: 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: 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 on push event | |
if: github.event_name == 'push' | |
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 CUI on push event | |
if: github.event_name == 'push' | |
run: | | |
cd build/output/plugins/LiteLoader/ResourcePacks | |
7z a LiteLoaderBDS-CUI.zip 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 on push event | |
if: github.event_name == 'push' | |
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" | |
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\ |