2.1.2 #26
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Setup | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: adopt | |
- name: Cache Gradle dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.gradle/caches | |
key: ${{ runner.OS }}-gradle-${{ hashFiles('**/*.gradle') }} | |
restore-keys: | | |
${{ runner.OS }}-gradle- | |
- name: Grant execute permission for gradlew | |
run: chmod +x gradlew | |
# Attach output to release | |
- name: Get artifact version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
# Build and publish | |
- name: Build with Gradle | |
run: ./gradlew proguardJar | |
env: | |
jextVersion: ${{ env.VERSION }} | |
- name: Publish to Modrinth | |
run: ./gradlew modrinth | |
env: | |
modrinthApiKey: ${{ secrets.MODRINTH_TOKEN }} | |
modrinthChangelog: ${{ github.event.release.body }} | |
jextVersion: ${{ env.VERSION }} | |
- name: Sync Modrinth body | |
run: ./gradlew modrinthSyncBody | |
env: | |
modrinthApiKey: ${{ secrets.MODRINTH_TOKEN }} | |
modrinthChangelog: ${{ github.event.release.body }} | |
jextVersion: ${{ env.VERSION }} | |
- name: Publish to Hangar | |
run: ./gradlew publishPluginPublicationToHangar | |
env: | |
hangarApiKey: ${{ secrets.HANGAR_TOKEN }} | |
hangarChangelog: ${{ github.event.release.body }} | |
jextVersion: ${{ env.VERSION }} | |
- name: Attach artifact to release | |
id: upload-release-asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./build/libs/JEXT-Reborn_${{ env.VERSION }}.jar | |
asset_name: JEXT-Reborn_${{ env.VERSION }}.jar | |
asset_content_type: application/java-archive |