添加自动提交Tooth脚本

This commit is contained in:
Qiuzhizhe 2023-03-22 01:53:27 -07:00
parent bcf199e8d2
commit a5080d62ee
2 changed files with 77 additions and 2 deletions

View File

@ -231,10 +231,21 @@ jobs:
with:
path: build/
- name: Push Tooth
working-directory: ${{env.GITHUB_WORKSPACE}}
if: github.event.inputs.status == 'stable'
run: |
cd Scripts
./UploadTooth.sh ${{ github.event.inputs.tag }}
env:
REPO_KEY: ${{secrets.ACTIONS_TOKEN}}
USERNAME: github-actions[bot]
shell: bash
- name: Pack artifacts
run: |
cd build/
zip -9r LiteLoaderBDS.zip LiteLoaderBDS/*
zip -9r LiteLoaderBDS-${{ github.event.inputs.tag }}.zip LiteLoaderBDS/*
zip -9r PDB.zip PDB/*
zip -9r Modules.zip PeEditor PreLoader LiteLoader ScriptEngine LLParticle LLPermission
shell: bash
@ -247,7 +258,7 @@ jobs:
tag: ${{ github.event.inputs.tag }}
bodyFile: RELEASE_NOTES.md
artifacts: |
build/LiteLoaderBDS.zip
build/LiteLoaderBDS-${{ github.event.inputs.tag }}.zip
build/Modules.zip
build/PDB.zip
env:

64
Scripts/UploadTooth.sh Normal file
View File

@ -0,0 +1,64 @@
#!/bin/bash
TOOTH_REMOTE_PATH=https://github.com/Tooth-Hub/LiteLoaderBDS-Legacy.git
cd ..
echo [INFO] Fetching LiteLoaderBDS-Legacy Tooth to GitHub ...
# 获取标签
now_tag=$(git describe --tags --always | cut -d "-" -f 1)
echo NOW_TAG $now_tag
echo [INFO] LiteLoaderBDS-Legacy Tooth Pulling from remote...
echo
git clone ${TOOTH_REMOTE_PATH} Tooth
# cd LiteLoaderBDS-Legacy
# git fetch --all
# git reset --hard origin/Protocol-408
# git checkout Protocol-408
# cd ..
echo
echo [INFO] Fetching LiteLoaderBDS-Legacy Tooth to GitHub finished
echo
# copy all from build/sdk to LiteLoaderSDK
cp -r build/LiteLoaderBDS/* Tooth
cd Tooth
version=$1
vers=" \"version\": \"${version:1}\","
#modify tooth.json
sed -i "4c\ ${vers}" ./tooth.json
now_status=$(git status . -s)
if [ "$now_status" ]; then
echo [INFO] Modified files found.
echo
git add .
git commit -m "${now_tag}"
git tag ${now_tag}
echo
echo [INFO] Pushing to origin...
echo
git push https://%USERNAME%:%REPO_KEY%@github.com/Tooth-Hub/LiteLoaderBDS-Legacy.git Protocol-408
git push --tags https://%USERNAME%:%REPO_KEY%@github.com/Tooth-Hub/LiteLoaderBDS-Legacy.git Protocol-408
cd ..
echo
echo [INFO] Upload finished.
echo
else
cd ..
echo
echo
echo [INFO] No modified files found.
echo [INFO] No need to Upgrade LiteLoaderBDS-Legacy.
fi