From 3bb436f0992f6b064b0e3d7bbd3beff9a4bf0b50 Mon Sep 17 00:00:00 2001 From: plulsls Date: Wed, 8 Sep 2021 13:05:26 +0800 Subject: [PATCH] update github action --- .github/workflows/build.yml | 11 +---------- .github/workflows/publish.yml | 36 ++++++++++++++++------------------- gradle.properties | 2 +- 3 files changed, 18 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5fccf6..aa3b5e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,12 +28,9 @@ jobs: id: getid run: | echo "::set-output name=commitID::${GITHUB_SHA::7}" - - name: Display commit id - run: | - echo MasaGadget commit-${{ steps.getid.outputs.commitID }} \(Public Beta\) - name: Set commit id in codes run: | - sed -i "s/alpha/beta.${{ steps.getid.outputs.commitID }}/g" gradle.properties + sed -i "s/alpha.114514/beta.${{ steps.getid.outputs.commitID }}/g" gradle.properties - name: Read relevant fields from gradle.properties id: properties run: | @@ -47,12 +44,6 @@ jobs: - name: make gradle wrapper executable if: ${{ runner.os != 'Windows' }} run: chmod +x ./gradlew - - name: copy linux deps - if: ${{ runner.os != 'Windows' }} - run: mkdir -p build/loom-cache && cp ./deps/* ./build/loom-cache/. - - name: copy windows deps - if: ${{ runner.os == 'Windows' }} - run: mkdir build\\loom-cache && copy .\deps\* .\\build\\loom-cache - name: build run: ./gradlew build - name: capture build artifacts diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dbf7079..d01c5d4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,7 +9,7 @@ jobs: matrix: java: [ 16 ] os: [ ubuntu-20.04 ] - branch: [ 1.16, 1.17 ] + branch: [ 1.16, 1.17, 1.18 ] runs-on: ${{ matrix.os }} steps: - name: checkout repository @@ -22,35 +22,25 @@ jobs: uses: actions/setup-java@v1 with: java-version: ${{ matrix.java }} - - name: Display build number - run: echo MasaGadget build\#$GITHUB_RUN_NUMBER \(Public Release\) - name: Set build number in codes run: | - sed -i "s/build.undefined/build.$GITHUB_RUN_NUMBER/g" gradle.properties - sed -i "s/build.undefined/build.$GITHUB_RUN_NUMBER/g" src/main/java/com/plusls/MasaGadget/ModInfo.java - sed -i "s/Version Exception/Public Release/g" src/main/java/com/plusls/MasaGadget/ModInfo.java + sed -i "s/-alpha.114514//g" gradle.properties - name: make gradle wrapper executable if: ${{ runner.os != 'Windows' }} run: chmod +x ./gradlew - - name: copy linux deps - if: ${{ runner.os != 'Windows' }} - run: mkdir -p build/loom-cache && cp ./deps/* ./build/loom-cache/. - - name: copy windows deps - if: ${{ runner.os == 'Windows' }} - run: mkdir build\\loom-cache && copy .\deps\* .\\build\\loom-cache - name: build run: ./gradlew build - - name: Upload assets to GitHub - uses: AButler/upload-release-assets@v2.0 - if: ${{ runner.os == 'Linux' && matrix.java == '16' }} - with: - files: 'build/libs/*;LICENSE' - repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Find correct JAR id: findjar run: | output="$(find build/libs/ ! -name "*-dev.jar" ! -name "*-sources.jar" -type f -printf "%f\n")" echo "::set-output name=jarname::$output" + - name: Upload assets to GitHub + uses: AButler/upload-release-assets@v2.0 + if: ${{ runner.os == 'Linux' && matrix.java == '16' }} + with: + files: build/libs/${{ steps.findjar.outputs.jarname }} + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Upload to Curseforge uses: itsmeow/curseforge-upload@v3 with: @@ -61,5 +51,11 @@ jobs: changelog_type: markdown changelog: ${{ github.event.release.body }} # 1.16.5:8203, 1.17:8516, fabric:7499 - game_versions: ${{ fromJson('{"1.16":"8203","1.17":"8516"}')[matrix.branch] }}, 7499 - release_type: release \ No newline at end of file + game_versions: ${{ fromJson('{"1.16":"8203","1.17":"8516","1.18":"8633"}')[matrix.branch] }}, 7499 + release_type: release + - name: Upload to Modrinth + if: ${{ runner.os == 'Linux' && matrix.java == '16' }} + run: | + ./gradlew publishModrinth + env: + MODRINTH: ${{ secrets.MODRINTH }} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index f5f89e0..4d28606 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ minecraft_version=1.17.1 yarn_mappings=1.17.1+build.10 loader_version=0.11.6 # Mod Properties -mod_version=0.3.6-alpha +mod_version=0.3.7-alpha.114514 maven_group=com.plusls archives_base_name=oh-my-minecraft-client # Dependencies