Skip to content

Commit

Permalink
添加自动提交Tooth脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
quizhizhe committed Mar 22, 2023
1 parent bcf199e commit a5080d6
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
64 changes: 64 additions & 0 deletions Scripts/UploadTooth.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a5080d6

Please sign in to comment.