check_mcversion.yml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. name: Check Minecraft Version
  2. on:
  3. schedule:
  4. - cron: '0/10 * * * *'
  5. workflow_dispatch:
  6. jobs:
  7. check_mcv:
  8. runs-on: Linux
  9. steps:
  10. - name: 签出储存库
  11. uses: actions/checkout@v4
  12. - name: 配置 Python 环境
  13. uses: actions/setup-python@v4
  14. with:
  15. python-version: 3.11
  16. - name: 安装依赖
  17. run: |
  18. python -m pip install --upgrade pip
  19. pip install requests
  20. - name: 运行更新脚本
  21. id: run_script
  22. run: python Actions/check_mcv.py >> "$GITHUB_ENV"
  23. - name: 显示版本信息
  24. run: |
  25. printf '● 最新 %s 版: %s %s\n' "$latest_release_type" "$latest_release_id" "$latest_release_act"
  26. printf '● 最新 %s 版: %s %s\n' "$latest_snapshot_type" "$latest_snapshot_id" "$latest_snapshot_act"
  27. - name: 配置 Git 信息
  28. if: ${{ env.require_update }}
  29. run: |
  30. git config --local user.email "[email protected]"
  31. git config --local user.name "Hilda Bot"
  32. - name: 配置 GPG 信息
  33. if: ${{ env.require_update }}
  34. uses: crazy-max/ghaction-import-gpg@v6
  35. with:
  36. gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
  37. git_user_signingkey: true
  38. git_commit_gpgsign: true
  39. - name: 提交与推送更改
  40. if: ${{ env.require_update }}
  41. run: |
  42. git add *
  43. git diff-index --quiet HEAD || git commit -S -m "preloaded new version" && git push
  44. - name: 显示报错信息
  45. if: ${{ failure() && steps.run_script.conclusion == 'failure' }}
  46. run: |
  47. printf '获取版本列表失败: %s' "$error_log"