feat: 添加 bStats 指标统计功能 #18
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: CI-Build & Release | |
| on: | |
| push: | |
| branches: [ master ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| java-version: 21 | |
| distribution: temurin | |
| cache: maven | |
| - name: 生成短 SHA | |
| if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/v') | |
| id: sha | |
| run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT | |
| - name: 设置快照版本 | |
| if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| mvn -B versions:set \ | |
| -DnewVersion=#${{ steps.sha.outputs.SHORT_SHA }} \ | |
| -DgenerateBackupPoms=false | |
| - name: 编译测试 & 打包快照 | |
| if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/v') | |
| run: mvn -B package | |
| - name: 上传快照包 | |
| if: github.event_name != 'push' || !startsWith(github.ref, 'refs/tags/v') | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: EventsCountdown-#${{ steps.sha.outputs.SHORT_SHA }} | |
| path: target/EventsCountdown-*.jar | |
| - name: 设置发布版本 | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| VERSION=${GITHUB_REF_NAME#v} | |
| mvn -B versions:set -DnewVersion="$VERSION" -DgenerateBackupPoms=false | |
| - name: 重新构建(跳过测试) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: mvn -B package -DskipTests | |
| - name: 发布 Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: target/EventsCountdown-*.jar | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| generate_release_notes: true |