This commit is contained in:
kenzok8 2023-09-07 15:49:01 +00:00
parent cdbc30695e
commit 04e5b15c4e
2 changed files with 23 additions and 3 deletions

7
.github/diy/test.sh vendored Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
# 假设您的插件版本号可以通过执行命令来获取,例如 sing-box version
PLUGIN_VERSION=$(${{ matrix.pakcages }} version | grep "$PKG_VERSION")
# 将版本号输出到标准输出
echo "$PLUGIN_VERSION"

View File

@ -51,14 +51,27 @@ jobs:
bash /$GITHUB_WORKSPACE/.github/diy/create_acl_for_luci.sh -a
bash /$GITHUB_WORKSPACE/.github/diy/Modify.sh
- name: Upload
env:
- name: Get Plugin Versions
id: get_versions
run: |
cd $GITHUB_WORKSPACE/.github/diy/
chmod +x test.sh
PLUGIN_VERSION=$("./test.sh") # 执行脚本并获取输出
echo "::set-output name=plugin_version::$PLUGIN_VERSION" # 将版本号设置为输出变量
- name: Check and Commit New Versions
env:
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
cd $GITHUB_WORKSPACE/${{matrix.target}}
if git status --porcelain | grep .; then
PLUGIN_VERSION="${{ steps.get_versions.outputs.plugin_version }}"
# 设置提交消息为自定义格式,包括插件版本号
COMMIT_MESSAGE="${{matrix.target}}: update to $PLUGIN_VERSION"
git add .
git commit -am "update $(date '+%Y-%m-%d %H:%M:%S')"
git commit -m "$COMMIT_MESSAGE"
git push --quiet "https://${{ secrets.ACCESS_TOKEN }}@github.com/kenzok8/litte.git" HEAD:${{matrix.target}}
else
echo "nothing to commit"