check_mcversion.yml 1.7 KB

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