Skip to content

Commit

Permalink
added publish task
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellpeck committed Nov 22, 2024
1 parent 3d5f592 commit db97e2d
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 4 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone repository
- name: Clone Repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'temurin'
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ hashFiles('**/build.gradle', '**/gradle-wrapper.properties') }}
key: ${{ hashFiles('**/build.gradle', '**/gradle-wrapper.properties', '**/gradle.properties') }}
- name: Build
run: |
chmod +x ./gradlew
Expand All @@ -25,4 +25,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: Mod Jar
path: build/libs/**.jar
path: build/libs/**.jar
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
on:
push:
tags: ["*"]
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ hashFiles('**/build.gradle', '**/gradle-wrapper.properties', '**/gradle.properties') }}
- name: Grab Changelog from Commit Message Body
run: |
changelog=$(echo -e "$MESSAGE" | sed -n '/^$/,$p' | sed '1d')
echo -e "$changelog"
{
echo 'CHANGELOG<<EOF'
echo -e "$changelog"
echo EOF
} >> "$GITHUB_ENV"
env:
MESSAGE: ${{ github.event.head_commit.message }}
- name: Release
run: |
chmod +x ./gradlew
./gradlew publishMods --no-daemon
env:
MR_TOKEN: ${{ secrets.MR_TOKEN }}
CF_TOKEN: ${{ secrets.CF_TOKEN }}
26 changes: 26 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ plugins {
id 'idea'
id 'maven-publish'
id 'net.neoforged.gradle.userdev' version '7.0.163'
id 'me.modmuss50.mod-publish-plugin' version "0.7.4"
}

tasks.named('wrapper', Wrapper).configure {
Expand Down Expand Up @@ -171,3 +172,28 @@ idea {
downloadJavadoc = true
}
}

publishMods {
def cfToken = providers.environmentVariable("CF_TOKEN")
def mrToken = providers.environmentVariable("MR_TOKEN")
dryRun = !cfToken.isPresent() || !mrToken.isPresent()
changelog = providers.environmentVariable("CHANGELOG").orElse("")
version = mod_version
type = me.modmuss50.mpp.ReleaseType.valueOf(mod_release_state)
file = tasks.jarJar.archiveFile
modLoaders.add("neoforge")

modrinth {
accessToken = mrToken
projectId = "XExdLWCQ"
minecraftVersions.add(minecraft_version)
optional("jei")
}

curseforge {
accessToken = cfToken
projectId = "376737"
minecraftVersions.add(minecraft_version)
optional("jei")
}
}
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ mod_name=PrettyPipes
mod_license=MIT
# The mod version. See https://semver.org/
mod_version=1.18.0
mod_release_state=BETA
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
Expand Down

0 comments on commit db97e2d

Please sign in to comment.