From 609a5cfa395f15f68dd80282c680df900fd6f1d5 Mon Sep 17 00:00:00 2001 From: UltraProdigy <187078471+UltraProdigy@users.noreply.github.com> Date: Wed, 4 Nov 2026 09:58:28 -0500 Subject: [PATCH] Add Support For Creating Non-Latest Releases (#76) --- .github/workflows/release-tags.yml | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-tags.yml b/.github/workflows/release-tags.yml index de7aed5..a54851b 100644 --- a/.github/workflows/release-tags.yml +++ b/.github/workflows/release-tags.yml @@ -79,14 +79,20 @@ jobs: - name: Build the mod run: ./gradlew --build-cache --info --stacktrace -PmavenPublishUrl='${{ env.MAVEN_PUBLISHING_URL }}' assemble - # Continue on error in the following steps to make sure releases still get made even if one of the methods fails - - name: Delete old release if it already exists - run: gh release delete --yes "${RELEASE_VERSION}" - continue-on-error: true + run: | + if gh release view "$RELEASE_VERSION" > /dev/null; then + LATEST_TAG=$(gh api "repos/$GITHUB_REPOSITORY/releases/latest" --jq .tag_name) || exit 1 + if [[ "$LATEST_TAG" != "$RELEASE_VERSION" ]]; then + echo "LATEST_FLAG=--latest=false" >> "$GITHUB_ENV" + fi + gh release delete --yes "$RELEASE_VERSION" || true + fi env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Continue on error in the following steps to make sure releases still get made even if one of the methods fails + - name: Release under current tag run: | PRERELEASE_FLAG="" @@ -110,7 +116,7 @@ jobs: --jq ".body" > "${CHANGELOG_FILE}" fi cat "${CHANGELOG_FILE}" - gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" ${PRERELEASE_FLAG} ./build/libs/*.jar + gh release create "${RELEASE_VERSION}" -F "${CHANGELOG_FILE}" ${PRERELEASE_FLAG} ${LATEST_FLAG} ./build/libs/*.jar shell: bash continue-on-error: true env: