Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
C0D3-M4513R committed Jan 6, 2024
0 parents commit 9d0777e
Show file tree
Hide file tree
Showing 14 changed files with 779 additions and 0 deletions.
105 changes: 105 additions & 0 deletions .github/workflows/gradle-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Gradle Package

on:
push:
branches: [master]
tags:
- v*
pull_request:
branches: [master]

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Get Version Name
id: version_name
run: |
echo version=${GITHUB_REF#refs/tags/v} >> $GITHUB_OUTPUT
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Build with Gradle
uses: gradle/[email protected]
with:
arguments: build
env:
VERSION: ${{ steps.version_name.outputs.version }}

- name: Generate Release Hash
id: hash
run: echo "$(git rev-parse --short HEAD)" > hash.env

- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: jar
path: build/libs/kettingcommon-*.jar

- name: Upload Hash
uses: actions/upload-artifact@v3
with:
name: hash
path: hash.env


release:
needs: build
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
permissions:
contents: write
packages: write

steps:
- uses: actions/checkout@v3
- name: Download Build Artifact
uses: actions/download-artifact@v3
with:
name: jar
path: tmp

- name: Download Hash
uses: actions/download-artifact@v3
with:
name: hash
path: tmp
- name: Get Version Name
id: version_name
run: |
echo version=${GITHUB_REF#refs/tags/v} >> $GITHUB_OUTPUT
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Build with Gradle
uses: gradle/[email protected]
with:
arguments: publish
env:
KETTINGUSERNAME: ${{ secrets.KETTINGUSERNAME }}
KETTINGPASSWORD: ${{ secrets.KETTINGPASSWORD }}
VERSION: ${{ steps.version_name.outputs.version }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
run: |
gh release create "v$VERSION" tmp/kettingcommon-*.jar \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} v$VERSION" \
--generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.version_name.outputs.version }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.idea/
.gradle/
build/
73 changes: 73 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import net.minecraftforge.gradleutils.PomUtils

plugins {
id 'java-library'
id 'maven-publish'
id 'net.minecraftforge.gradleutils' version '2.3.5'
}

repositories {
mavenCentral()
maven { url = 'https://nexus.c0d3m4513r.com/repository/Ketting/' }
maven { url = 'https://nexus.c0d3m4513r.com/repository/Forge/' }
mavenLocal()
}

dependencies {
compileOnly 'org.jetbrains:annotations:23.0.0'
api(libs.bundles.asm) // Needed by all the black magic
}

java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
withSourcesJar()
}

tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:-unchecked'
}

group = 'org.kettingpowered'
version = System.getenv("VERSION") ?: 'dev-ver'

publishing {
publications.register('mavenJava', MavenPublication).configure {
from components.java
artifactId = 'kettingcommon'
pom {
name = project.name
description = 'Version specific things needed in kettinglauncher and the server itself'
url = "https://github.com/kettingpowered/kettingcommon"
developers {
developer {
id = "justred23"
name = "JustRed23"
}
developer {
id = "c0d3m4513r"
name = "C0D3 M4513R"
}
}
PomUtils.setGitHubDetails(pom, 'kettingpowered', 'kettingcommon')
}
}

repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/kettingpowered/kettingcommon")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
maven {
name = 'kettingRepo'
credentials {
username = System.getenv("KETTINGUSERNAME")
password = System.getenv("KETTINGPASSWORD")
}
url = "https://nexus.c0d3m4513r.com/repository/Ketting/"
}
}
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
8 changes: 8 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=f2b9ed0faf8472cbe469255ae6c86eddb77076c75191741b4a462f33128dd419
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 9d0777e

Please sign in to comment.