Skip to content

Release

Release #71

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/checkout@v3.2.0
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/upload-artifact@v3.1.0
with:
name: LiteLoaderBDS
path: |
${{ github.workspace }}\build\output\
- name: Upload PDB files
uses: actions/upload-artifact@v3.1.0
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