Skip to content

Commit

Permalink
Merged publishing into build, using mc-publish now, removed publishin…
Browse files Browse the repository at this point in the history
…g tasks for gradle
  • Loading branch information
SwanX1 committed Mar 22, 2022
1 parent 8116173 commit afba981
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 138 deletions.
30 changes: 27 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Build JAR
name: Build and publish
on:
workflow_dispatch:
push:
tags:
- '1.18/*'
branches: [ '1.18' ]
paths:
- 'build.gradle'
Expand All @@ -11,6 +12,7 @@ on:
paths:
- 'src/**'
- 'build.gradle'

jobs:
build:
runs-on: ubuntu-20.04
Expand All @@ -34,5 +36,27 @@ jobs:
- name: Upload Build Artifact
uses: actions/upload-artifact@v2
with:
name: Generated JAR
name: build-artifacts
path: build/libs/

publish:
runs-on: ubuntu-20.04
if: ${{ success() && github.ref_type == 'tag' }}
needs: [ build ]
steps:
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build-artifacts
path: build/libs/

- name: Publish build artifacts
uses: Kir-Antipov/mc-publish@v2.1
with:
modrinth-id: VZWuyRVr
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}

curseforge-id: 441114
curseforge-token: ${{ secrets.CURSEFORGE_TOKEN }}

github-token: ${{ secrets.GITHUB_TOKEN }}
55 changes: 0 additions & 55 deletions .github/workflows/publish.yml

This file was deleted.

81 changes: 1 addition & 80 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
buildscript {
repositories {
maven { url = 'https://files.minecraftforge.net/maven' }
maven { url = 'https://plugins.gradle.org/m2/' }

jcenter()
mavenCentral()
}

dependencies {
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1+', changing: true
classpath group: 'gradle.plugin.com.modrinth.minotaur', name: 'Minotaur', version: '1.2.1'
classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: '1.4.0'
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1+', changing: true
}
}

apply plugin: 'net.minecraftforge.gradle'
apply plugin: 'eclipse'
apply plugin: 'maven-publish'
apply plugin: 'com.matthewprenger.cursegradle'

// This initializes the config. Please try to modify the variables in the config file, if needed, add more if you see a reason to.
ext.config = parseConfig(file('build.properties'))
Expand Down Expand Up @@ -99,81 +95,6 @@ task sourcesJar(type: Jar) {

tasks.build.dependsOn sourcesJar

publishing {
publications {
mavenJava(MavenPublication) {
groupId = config.GROUP
artifactId = config.ARTIFACT
artifact jar
artifact sourcesJar
version "${config.VERSION}-${config.MINECRAFT_VERSION}"

pom {
name = 'Infernal Expansion'
url = 'https://infernalstudios.org/secondchanceforge'
licenses {
license {
name = 'Apache License 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
connection = 'scm:git:git://github.com/infernalexp/Second-Chance-Forge.git'
url = 'https://github.com/infernalexp/Second-Chance-Forge'
}
}
}
}
repositories {
maven {
url 'https://maven.infernalstudios.org/releases'

credentials {
username = System.getenv('MAVEN_USER')
password = System.getenv('MAVEN_TOKEN')
}

authentication {
basic(BasicAuthentication)
}
}
}
}

// Modrinth publishing
import com.modrinth.minotaur.TaskModrinthUpload

task publishModrinth (type: TaskModrinthUpload) {
onlyIf {
System.getenv('MODRINTH')
}

token = System.getenv('MODRINTH')
projectId = config.MODRINTH_ID
versionNumber = project.version
uploadFile = jar
addFile(sourcesJar)
addGameVersion(config.MINECRAFT_VERSION)
addLoader('forge')
}

// Curseforge publishing
curseforge {
apiKey = System.getenv('CURSEFORGE') ?: 'If you\'re seeing this, you haven\'t set your "CURSEFORGE" environment variable'

project {
id = config.CURSEFORGE_ID
changelog = 'No changelog specified.'
releaseType = 'release'
addGameVersion config.MINECRAFT_VERSION
mainArtifact (jar) {
displayName = "Second Chance (Forge) Release ${project.version}"
}
addArtifact sourcesJar
}
}


// Config parse function
def parseConfig(File config) {
config.withReader {
Expand Down

0 comments on commit afba981

Please sign in to comment.