diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..a204814 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,23 @@ +name: Publish package to GitHub Packages +on: + release: + types: [created] +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Publish package + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 36f614a..32df64a 100644 --- a/build.gradle +++ b/build.gradle @@ -3,13 +3,12 @@ plugins { id 'maven-publish' } -group = "org.thinkingstudio" -version = '0.1.0' -base.archivesName = "NeoPermissions" +group = "${project.maven_group}" +version = "${project.mod_version}+mc${project.minecraft_version}" +base.archivesName = "${project.archives_base_name}" repositories { maven { url "https://maven.neoforged.net/releases/" } - maven { url "https://maven.su5ed.dev/releases" } } dependencies { @@ -43,3 +42,22 @@ tasks.withType(JavaCompile).configureEach { options.encoding = "UTF-8" options.release = 21 } + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + } + } + + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/thinkingstudios/NeoPermissions") + credentials { + username = project.findProperty("gpr.user") ?: System.getenv("USERNAME") + password = project.findProperty("gpr.key") ?: System.getenv("TOKEN") + } + } + } +} diff --git a/gradle.properties b/gradle.properties index 4d2e976..c48565f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,6 +2,10 @@ org.gradle.jvmargs=-Xmx2G loom.platform=neoforge +mod_version=0.1.0 +maven_group=org.thinkingstudio.neopermissions +archives_base_name=NeoPermissions + minecraft_version=1.20.6 yarn_mappings=1.20.6+build.3 yarn_patch=1.20.6+build.4