check_mcversion.yml 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. name: Check Minecraft Version
  2. on:
  3. schedule:
  4. - cron: '0/10 * * * *'
  5. workflow_dispatch:
  6. jobs:
  7. check_mcv:
  8. runs-on: self-hosted
  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: |
  23. python Actions/check_mcv.py >> "$GITHUB_ENV"
  24. printf '● 最新 %s 版:%s %s\n' "$latest_release_type" "$latest_release_id" "latest_release_act"
  25. printf '● 最新 %s 版:%s %s\n' "$latest_snapshot_type" "$latest_snapshot_id" "latest_snapshot_act"
  26. - name: 配置 Git 信息
  27. if: ${{ env.require_update == true }}
  28. run: |
  29. git config --local user.email "[email protected]"
  30. git config --local user.name "Hilda Bot"
  31. - name: 配置 GPG 信息
  32. if: ${{ env.require_update == true }}
  33. uses: crazy-max/ghaction-import-gpg@v6
  34. with:
  35. gpg_private_key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
  36. git_user_signingkey: true
  37. git_commit_gpgsign: true
  38. - name: 提交与推送更改
  39. if: ${{ env.require_update == true }}
  40. run: |
  41. git add *
  42. git diff-index --quiet HEAD || git commit -S -m "preloaded new version" && git push
  43. - name: 显示报错信息
  44. if: ${{ failure() && steps.run_script.conclusion == 'failure' }}
  45. run: |
  46. printf '获取版本列表失败: %s' "$error_log"