Skip to content

Commit

Permalink
CI: prerelease
Browse files Browse the repository at this point in the history
  • Loading branch information
Discreater committed Dec 27, 2023
1 parent db251aa commit 6587bdf
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions .github/workflows/release-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -50,25 +55,16 @@ 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" \
"/repos/${GITHUB_REPOSITORY}/releases/generate-notes" \
-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 != '' }}

0 comments on commit 6587bdf

Please sign in to comment.