diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml deleted file mode 100644 index e36e948..0000000 --- a/.github/workflows/Build.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Release - -on: - push: - tags: - - 'v*' # 匹配以v开头的标签,例如v1.0.0 - -jobs: - build-and-release: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up JDK 21 - uses: actions/setup-java@v4 - with: - java-version: 21 - distribution: 'temurin' - cache: 'gradle' - - - name: Grant gradlew permission - run: chmod +x gradlew - - - name: Build with Gradle - run: ./gradlew build - - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref_name }} - draft: false - prerelease: false - - - name: Upload Release Asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: build/libs/*.jar - asset_name: ${{ github.ref_name }}.jar - asset_content_type: application/java-archive diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..12b4b89 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,34 @@ +name: Release Minecraft Mod + +on: + push: + tags: + - 'v*' # 只在推送 tag 时触发 + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'temurin' + + - name: Grant execute permission to gradlew + run: chmod +x gradlew # 确保 gradlew 可执行 + + - name: Build with Gradle + run: ./gradlew build # 使用正确的命令 + + - name: Upload to Release + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} # 修正语法 + asset_path: build/libs/*.jar + asset_name: MyMod-${{ github.ref_name }}.jar + asset_content_type: application/java-archive diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5e91f30 --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +# gradle + +.gradle/ +build/ +out/ + +# idea + +.idea/* +!.idea/icon.svg +*.iml +*.ipr +*.iws + +# vscode + +.settings/ +.vscode/ +bin/ +.classpath +.project + +# fabric + +run/ +logs/ + +/changelog.txt \ No newline at end of file diff --git a/build.gradle b/build.gradle index dbaecd7..9307b46 100644 --- a/build.gradle +++ b/build.gradle @@ -3,13 +3,7 @@ plugins { } group = 'cn.mcsfs' -version = '1.0-SNAPSHOT' - -def getVersionName = { - def tag = System.getenv("GITHUB_REF") ?: "v1.0.0" - tag = tag.replace("refs/tags/v", "").replace("refs/tags/", "") - return tag -} +version = '2025.1' version = getVersionName() @@ -58,5 +52,4 @@ processResources { tasks.withType(JavaCompile) { options.compilerArgs << "-Xlint:none" -} - +} \ No newline at end of file diff --git a/gradlew b/gradle wrapper similarity index 99% rename from gradlew rename to gradle wrapper index f5feea6..b26d411 100644 --- a/gradlew +++ b/gradle wrapper @@ -249,4 +249,4 @@ eval "set -- $( tr '\n' ' ' )" '"$@"' -exec "$JAVACMD" "$@" +exec "$JAVACMD" "$@" \ No newline at end of file