Skip to content

Publish using gradle task instead of actions job #4

Publish using gradle task instead of actions job

Publish using gradle task instead of actions job #4

Workflow file for this run

# partially taken from ModMenu's release workflow
name: Publish new Release
on:
push:
tags:
- 'v*'
jobs:
publish:
strategy:
matrix:
java: [21]
distro: [temurin]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repository
uses: actions/checkout@v5
with:
fetch-depth: '0'
- name: Check Gradle Wrapper
uses: gradle/actions/wrapper-validation@v5
- name: Setup JDK ${{ matrix.java }}
uses: actions/setup-java@v5
with:
distribution: ${{ matrix.distro }}
java-version: ${{ matrix.java }}
- name: Build
run: ./gradlew build
- name: Get tag message
run: |
{
echo 'GIT_TAG_CHANGELOG<<EOF'
git tag -l --format='%(contents)' ${{ github.ref_name }}
echo EOF
} >> "$GITHUB_ENV"
- name: Publish release to Github and Modrinth
run: ./gradlew github modrinth modrinthSyncBody
env:
GITHUB_TOKEN: ${{ github.token }}
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
GIT_TAG: ${{ github.ref_name }}
GIT_TAG_CHANGELOG: ${{ env.GIT_TAG_CHANGELOG }}