Check Minecraft Version #23804
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: Check Minecraft Version | |
on: | |
schedule: | |
- cron: '0/30 * * * *' | |
workflow_dispatch: | |
jobs: | |
check_mcv: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 签出储存库 | |
uses: actions/checkout@v4 | |
- name: 配置 Python 环境 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11 | |
- name: 安装依赖 | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: 运行更新脚本 | |
id: run_script | |
run: python Actions/check_mcv.py >> "$GITHUB_ENV" | |
- name: 显示版本信息 | |
run: | | |
printf '● 最新 %s 版: %s %s\n' "$latest_release_type" "$latest_release_id" "$latest_release_act" | |
printf '● 最新 %s 版: %s %s\n' "$latest_snapshot_type" "$latest_snapshot_id" "$latest_snapshot_act" | |
- name: 配置 Git 信息 | |
if: ${{ env.require_update }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "Hilda Bot" | |
- name: 配置 GPG 信息 | |
if: ${{ env.require_update }} | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }} | |
git_user_signingkey: true | |
git_commit_gpgsign: true | |
- name: 提交与推送更改 | |
if: ${{ env.require_update }} | |
run: | | |
git add * | |
git diff-index --quiet HEAD || git commit -S -m "preloaded new version" && git push | |
- name: 显示报错信息 | |
if: ${{ failure() && steps.run_script.conclusion == 'failure' }} | |
run: | | |
printf '获取版本列表失败: %s' "$error_log" |