feature: 添加UUID查询功能,镜像翻转原理图功能,使用缓存提升了查询速度 #8
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: Build and Release Mod | |
| # 触发条件 | |
| on: | |
| push: | |
| branches: [ "main", "master" ] # 推送到主分支时触发日常构建 | |
| tags: [ "v*" ] # 推送 v 开头的 tag 时触发自动发布 (例如 v1.0.0) | |
| pull_request: | |
| branches: [ "main", "master" ] # 收到 PR 时也会触发编译检查 | |
| # 权限设置:允许机器人自动创建 Release | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| name: Build and Deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| # 1. 拉取代码 | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| # 2. 设置 JDK 环境 | |
| # ⚠️ 注意:Minecraft 1.20.5 及以上要求 Java 21,1.18~1.20.4 是 Java 17 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| # 3. 设置 Gradle 缓存 (大幅加快后续编译速度) | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v3 | |
| # 4. 赋予 gradlew 执行权限 (防止 Windows 提交的代码在 Linux 上没有运行权限) | |
| - name: Make gradlew executable | |
| run: chmod +x ./gradlew | |
| # 5. 执行测试 | |
| - name: Run tests | |
| run: ./gradlew test | |
| # 6. 执行编译 | |
| - name: Build with Gradle | |
| run: ./gradlew build | |
| # 7. 上传 Artifact (日常构建也能下载打包好的 jar 测试) | |
| - name: Upload Build Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: mod-artifacts | |
| path: build/libs/*.jar # 收集 build/libs 目录下的所有 jar 包 | |
| # 8. 上传测试报告 (测试失败时可查看详细报告) | |
| - name: Upload Test Report | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-report | |
| path: build/reports/tests/ | |
| # 9. 自动创建 GitHub Release (仅在打 tag 时执行) | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| with: | |
| files: build/libs/*.jar # 把编译出来的 jar 包附加到 Release 中 | |
| generate_release_notes: true # 自动根据提交记录生成更新日志 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |