From 6587bdf14d298ce5c793b83226ca4a9210569afb Mon Sep 17 00:00:00 2001 From: Discreater Date: Wed, 27 Dec 2023 11:21:36 +0800 Subject: [PATCH] CI: prerelease --- .github/workflows/release-tags.yml | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml index dee08b70f..6953b9298 100644 --- a/.github/workflows/release-tags.yml +++ b/.github/workflows/release-tags.yml @@ -19,26 +19,31 @@ jobs: - name: Set release version run: | - IFS='-' read -r mv pv <<< "${GITHUB_REF#refs/*/}" + IFS='-' read -r mv pv <<< "${{ github.ref_name }}" echo "MC_VERSION=${mv}" >> $GITHUB_ENV echo "RELEASE_VERSION=${pv}" >> $GITHUB_ENV echo "VERSION=${pv}" >> $GITHUB_ENV - - name: Set up JDK 8 + - name: Validate gradle wrapper checksum + uses: gradle/wrapper-validation-action@v1 + + - name: Set up JDK 8 and 17 uses: actions/setup-java@v3 with: - java-version: '8' - distribution: 'temurin' + java-version: | + 8 + 17 + distribution: 'zulu' cache: gradle - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Setup the workspace - run: ./gradlew --info --stacktrace ${{ inputs.workspace }} + run: ./gradlew --build-cache --info --stacktrace ${{ inputs.workspace }} - name: Build the mod - run: ./gradlew --info --stacktrace build + run: ./gradlew --build-cache --info --stacktrace build # Continue on error in the following steps to make sure releases still get made even if one of the methods fails @@ -50,6 +55,7 @@ jobs: - name: Release under current tag run: | + PRERELEASE="--prerelease" export "CHANGELOG_FILE=$(mktemp --suffix=.md)" echo "CHANGELOG_FILE=${CHANGELOG_FILE}" >> $GITHUB_ENV gh api --method POST -H "Accept: application/vnd.github+json" \ @@ -57,18 +63,8 @@ jobs: -f tag_name="${MC_VERSION}-${RELEASE_VERSION}" \ --jq ".body" > "${CHANGELOG_FILE}" cat "${CHANGELOG_FILE}" - gh release create "${MC_VERSION}-${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" ./build/libs/*.jar + gh release create "${MC_VERSION}-${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" $PRERELEASE ./build/libs/*.jar shell: bash continue-on-error: true env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Publish to Maven, Modrinth and CurseForge - run: ./gradlew --info --stacktrace build publish - continue-on-error: true - env: - MAVEN_USER: ${{ secrets.MAVEN_USER }} - MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} - MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - CURSEFORGE_TOKEN: ${{ secrets.CURSEFORGE_TOKEN }} - if: ${{ env.MAVEN_USER != '' }} \ No newline at end of file