diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 1f5b0a6..4ec42d9 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -3,11 +3,7 @@ name: Java CI with Gradle -on: - push: - branches: [main] - pull_request: - branches: [main] +on: [ push, pull_request ] jobs: build: @@ -15,23 +11,48 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v2 - with: - java-version: '8' - distribution: 'adopt' - architecture: x64 - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew distZip - - name: Unzip - run: unzip -o ./build/distributions/*.zip -d ./dist/ - - name: Upload Zip - uses: actions/upload-artifact@v1.0.0 - with: - name: FakePlayer - path: ./dist/ - + + - uses: actions/checkout@v2 + + # Set up JDK + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + architecture: x64 + cache: gradle + + # Make gradlew executable + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + # Build + - name: Build with Gradle + run: ./gradlew distZip + + # Unzip because Actions only support folders as artifacts + - name: Unzip + run: unzip -o ./build/distributions/*.zip -d ./dist/ + + # Upload artifacts + - name: Upload Zip + uses: actions/upload-artifact@v1.0.0 + with: + name: FakePlayer + path: ./dist/ + + # Rename distribution for release + - name: Rename distribution + if: startsWith(github.ref, 'refs/tags/') + run: mv ./build/distributions/*.zip ./build/distributions/FakePlayer-$(./gradlew -q getVersion).zip + + # Publish new version + - name: Publish new version + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + env: + GITHUB_REPOSITORY: ddf8196/FakePlayer + with: + body_path: ${{ github.workspace }}/release-notes.md + files: ${{ github.workspace }}/build/distributions/*.zip diff --git a/build.gradle b/build.gradle index 024ed70..835a439 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ plugins { } group 'com.ddf.fakeplayer' -version '0.5.3-alpha' +version '0.5.4-alpha' repositories { maven { @@ -102,6 +102,10 @@ static def replace(String input, String name, String value) { return (input =~ /${regex}/).replaceAll(value) } +task getVersion { + print version +} + task runGUI(type: JavaExec) { classpath = run.classpath main = run.main diff --git a/release-notes.md b/release-notes.md new file mode 100644 index 0000000..97fee3c --- /dev/null +++ b/release-notes.md @@ -0,0 +1,5 @@ +## 更新内容 +* 支持1.18.30版本(协议版本503) + +## Change Log +* Support 1.18.30 version (Protocol 503) \ No newline at end of file