Skip to content

Commit

Permalink
automatic upload to curseforge
Browse files Browse the repository at this point in the history
  • Loading branch information
RogueLogix committed Aug 17, 2022
1 parent 6fc1efe commit be8d2f7
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 2 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/builds.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: builds
on: [push]
on:
push:
tags-ignore:
- '*'
jobs:
reobfJar:
runs-on: Felix
Expand Down
76 changes: 76 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: publish
on:
push:
tags:
- '*'
jobs:
build:
name: "Build for Publish"
runs-on: Felix
outputs:
mc_version: ${{ steps.verinfo.outputs.mcver }}
mc_major_version: ${{ steps.mverinfo.outputs.mcver }}
release_type: ${{ steps.mainbuild.outputs.reltype }}
quartz_version_range: ${{ steps.mainbuild.outputs.quartz_version_range }}
phos_version_range: ${{ steps.mainbuild.outputs.phos_version_range }}
steps:
- uses: actions/checkout@v2
- run: git submodule update --init --recursive
- id: mainbuild
run: ./gradlew build
- run: ./gradlew publish
- run: mkdir jars
- run: mv build/libs/biggerreactors-* jars/
- uses: actions/upload-artifact@v2
with:
name: jars
path: jars/*
- id: verinfo
run: echo "::set-output name=mcver::$(cat gradle.properties | grep mc_version | sed -n -e 's/^.*=//p')"
- id: mverinfo
run: echo "::set-output name=mcver::$(cat gradle.properties | grep mc_version | grep -o '1...' )"
- id: relinfo
run: echo "::set-output name=reltype::$(cat gradle.properties | grep "postfix=" | sed -n -e 's/^.*=//p')"

uploadToCurseforge:
name: "Upload to Curseforge"
runs-on: Felix
needs: [build]
outputs:
curseforge_file_id: ${{ steps.upload.outputs.id }}
steps:
- uses: actions/[email protected]
with:
name: jars
path: jars/*
- id: upload
uses: itsmeow/[email protected]
with:
token: "${{ secrets.CF_API_TOKEN }}"
project_id: 407780
game_endpoint: minecraft
file_path: "jars/biggerreactors-${{ needs.build.outputs.mc_version }}-${{ github.ref_name }}.jar"
game_versions: "Minecraft ${{ needs.build.outputs.mc_major_version }}:${{ needs.build.outputs.mc_version }},Java 17,Forge"
release_type: "${{ needs.build.outputs.release_type }}"
changelog: "https://github.com/BiggerSeries/BiggerReactors/blob/${{ github.ref_name }}/changelog.md
${{ needs.build.outputs.quartz_version_range }}
${{ needs.build.outputs.quartz_version_range }}"

addToGithubRelease:
name: "Upload to Github Release"
runs-on: Felix
needs: [build, uploadToCurseforge]
steps:
- uses: actions/[email protected]
with:
name: jars
path: jars/*
- uses: svenstaro/[email protected]
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: jars/*
tag: ${{ github.ref }}
overwrite: true
file_glob: true
body: "https://www.curseforge.com/minecraft/mc-mods/biggerreactors/files/${{ needs.uploadToCurseforge.outputs.curseforge_file_id }}"
2 changes: 1 addition & 1 deletion Phosphophyllite
16 changes: 16 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,22 @@ publish.dependsOn('reobfJar')
//}

gradle.projectsEvaluated {
var phosVersionRange = project.project(":Phosphophyllite").property("compatibility").toString().split(',')
var phosMinVersion = phosVersionRange[0].substring(1)
var phosMaxVersion = phosVersionRange[1].substring(1, phosVersionRange[1].length() - 1)
var phosRequirementString = "Requires [Phosphophyllite](https://www.curseforge.com/minecraft/mc-mods/phosphophyllite) version of at least " + phosMinVersion + " but less than " + phosMaxVersion

var quartzVersionRange = project.project(":Quartz").property("compatibility").toString().split(',')
var quartzMinVersion = quartzVersionRange[0].substring(1)
var quartzMaxVersion = quartzVersionRange[1].substring(1, quartzVersionRange[1].length() - 1)
var quartzRequirementString = "Requires [Quartz](https://www.curseforge.com/minecraft/mc-mods/quartz) version of at least " + quartzMinVersion + " but less than " + quartzMaxVersion

println(phosRequirementString)
println(quartzRequirementString)

println("::set-output name=phos_version_range::" + phosRequirementString)
println("::set-output name=quartz_version_range::" + quartzRequirementString)


def resource_targets = ["META-INF/mods.toml", "pack.mcmeta"]
def into_targets = ["$rootDir/out/production/resources/", "$rootDir/out/production/${project.name}.main/", "$rootDir/bin/main/"]
Expand Down

0 comments on commit be8d2f7

Please sign in to comment.