name: 推送编译校验

on:
  push:

permissions:
  contents: read

concurrency:
  group: build-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    name: Windows / Java 17
    runs-on: windows-latest
    timeout-minutes: 45

    steps:
      - name: 检出代码
        uses: actions/checkout@v6

      - name: 配置 Java 17
        uses: actions/setup-java@v5
        with:
          distribution: microsoft
          java-version: '17'

      - name: 配置 Gradle
        uses: gradle/actions/setup-gradle@v6

      - name: 编译并校验
        shell: pwsh
        run: .\gradlew.bat --no-daemon "-Dorg.gradle.java.home=$env:JAVA_HOME" build

      - name: 保存构建产物
        uses: actions/upload-artifact@v7
        with:
          name: mydimension-${{ github.sha }}
          path: build/libs/*.jar
          if-no-files-found: error
          retention-days: 7
