Skip to content

Commit

Permalink
Start publishing to maven
Browse files Browse the repository at this point in the history
  • Loading branch information
Matyrobbrt committed May 27, 2024
1 parent 6993f33 commit d6dc60b
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 6 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/publish_maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish artifacts to Central

on:
push:
branches:
- main
workflow_dispatch:

jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4
with:
fetch-depth: 1000
fetch-tags: true

- name: Validate wrapper
uses: gradle/actions/wrapper-validation@v3

- name: Setup Java 21
if: inputs.version_task
run: |
echo "JAVA_HOME=$(echo $JAVA_HOME_21_X64)" >> "$GITHUB_ENV"
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Make gradlew executable
run: chmod +x ./gradlew

- name: Publish
run: ./gradlew publish closeAndReleaseSonatypeStagingRepository
env:
GPG_SUBKEY: ${{ secrets.GPG_SUBKEY }}
GPG_SUBKEY_ID: ${{ secrets.GPG_SUBKEY_ID }}
GPG_SUBKEY_PASSWORD: ${{ secrets.GPG_SUBKEY_PASSWORD }}
SONATYPE_USER: ${{ secrets.SONATYPE_USER }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
9 changes: 3 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ import java.nio.file.Files

plugins {
id 'java'
id 'net.neoforged.gradleutils' version '2.+'
id 'net.neoforged.gradleutils' version '3.0.0-alpha.13'
id 'com.github.johnrengelman.shadow' version '7.+'
}

group 'net.neoforged'
println("Version: ${version = gradleutils.getTagOffsetVersion()}")
changelog {
fromTag '1.0'
}
group 'net.neoforged.camelot'
println("Version: ${version = gradleutils.version}")

tasks.register('run', JavaExec).configure {
classpath(sourceSets.main.runtimeClasspath)
Expand Down
33 changes: 33 additions & 0 deletions config/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,47 @@
plugins {
id 'groovy'
id 'java-library'
id 'maven-publish'
}

group = rootProject.group
version = rootProject.version

rootProject.gradleutils {
setupCentralPublishing()
setupSigning(project: this.project, signAllPublications: true)
}

repositories {
mavenCentral()
}

java.withSourcesJar()

groovydoc {
use = true
}

tasks.register('groovydocJar', Jar) {
dependsOn tasks.groovydoc
archiveClassifier = 'javadoc'
from groovydoc.destinationDir
}

dependencies {
api "org.apache.groovy:groovy:${project.groovy_version}"
api "org.apache.groovy:groovy-contracts:${project.groovy_version}"
implementation group: 'org.kohsuke', name: 'github-api', version: project.ghapi_version
}

tasks.groovydoc

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact(tasks.groovydocJar)
artifactId = 'camelot-config'
}
}
}

0 comments on commit d6dc60b

Please sign in to comment.