🌟 艾莉丝的包管理魔法阵 ~ #33
This file contains hidden or 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: 🌟 艾莉丝的包管理魔法阵 ~ | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| on: | |
| schedule: | |
| # 每天 UTC 时间 2 点运行(北京时间 10 点) | |
| - cron: '0 2 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| auto-update-packages: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 检出魔法书 | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: 准备魔法环境 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: 学习魔法咒语 | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install requests | |
| - name: 施展版本探知魔法 | |
| id: update | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| echo "艾莉丝开始探查各个模块的最新版本了哦~" | |
| # 运行更新脚本 | |
| python .github/scripts/update_packages.py | |
| # 检查是否有更新 | |
| if git diff --quiet packages.json; then | |
| echo "✨ 没有发现新的版本更新呢~" | |
| echo "has_updates=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "🌟 发现了新的版本信息!" | |
| echo "has_updates=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: 记录魔法日志 | |
| if: steps.update.outputs.has_updates == 'true' | |
| run: | | |
| echo "💫 艾莉丝正在记录今天的魔法发现..." | |
| updated_modules=$(git diff packages.json | grep '"version":' | wc -l) | |
| echo "📖 今日更新了 $updated_modules 个模块的版本信息" | |
| - name: 保存魔法成果 | |
| if: steps.update.outputs.has_updates == 'true' | |
| run: | | |
| git config --local user.email "eris@magic-circle.dev" | |
| git config --local user.name "Eris the Mage" | |
| git add packages.json | |
| git commit -m "✨ 艾莉丝的每日版本更新魔法 [skip ci] | |
| 🌟 自动更新了模块版本信息 | |
| 📖 更多详情请查看 packages.json" | |
| git push origin 2x | |
| - name: 💤 今天的魔法工作完成 | |
| if: steps.update.outputs.has_updates == 'true' | |
| run: | | |
| echo "🌟 艾莉丝今天也努力完成了版本更新的魔法呢!" | |
| echo "🌙 所有更新已直接推送到 2x 分支" | |
| echo "💫 明天再见啦~" | |
| - name: 无更新时的安慰信息 | |
| if: steps.update.outputs.has_updates != 'true' | |
| run: | | |
| echo "✨ 今天没有发现需要更新的模块呢~" | |
| echo "🌟 艾莉丝会继续守护着我们的魔法世界!" | |
| echo "🌙 明天再见啦~" |