Skip to content

Merge pull request #145 from Discreater/1.7.10-dev #2

Merge pull request #145 from Discreater/1.7.10-dev

Merge pull request #145 from Discreater/1.7.10-dev #2

Workflow file for this run

name: Release tagged build
on:
push:
tags: [ '*' ]
permissions:
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout mod repo
uses: actions/checkout@v3
with:
fetch-depth: 32
- name: Set release version
run: |
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: 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
17
distribution: 'zulu'
cache: gradle
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Setup the workspace
run: ./gradlew --build-cache --info --stacktrace ${{ inputs.workspace }}
- name: Build the mod
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
- name: Delete old release if it already exists
run: gh release delete --yes "${MC_VERSION}-${RELEASE_VERSION}"
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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}" $PRERELEASE ./build/libs/*.jar
shell: bash
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}