Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	build.gradle
  • Loading branch information
JustRed23 committed Dec 23, 2023
2 parents f60d2b8 + 92480b4 commit 9e2173d
Show file tree
Hide file tree
Showing 3 changed files with 187 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/kettingcore.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/kettingcore*.jar \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} v$VERSION" \
--generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ steps.version_name.outputs.version }}
82 changes: 82 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'java-library'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.0'
}

Expand Down Expand Up @@ -32,5 +33,86 @@ shadowJar {
archiveClassifier.set('')
archiveExtension.set('jar')

manifest {
attributes 'Specification-Title': 'Kettingpowered',
'Specification-Vendor': 'Kettingpowered',
'Implementation-Title': 'terminal-colors',
'Implementation-Version': version,
'Implementation-Vendor': 'Kettingpowered'
}

mergeServiceFiles()
}

task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier = 'sources'
from sourceSets.main.allSource
}

task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}

publishing {
publications {
myPublication(MavenPublication) {
from components.java
artifact(sourcesJar) {
// These values will be used instead of the values from the task. The task values will not be updated.
classifier "sources"
extension "jar"
}
artifact(javadocJar) {
//These values will be used instead of the values from the task. The task values will not be updated.
classifier "javadoc"
extension "jar"
}
// artifact jar
// groupId = "org.kettingpowered"
// artifactId = "terminal-colors"
version = System.getenv("VERSION")
pom {
name = "KettingCore"
description = "An API supported across all Ketting Versions"
url = "https://github.com/kettingpowered/terminal-colors"
licenses {
license {
name = "MIT License"
url = "http://www.opensource.org/licenses/mit-license.php"
}
}
developers {
developer {
id = "justred23"
name = "JustRed23"
//email = "jon@doe"
}
}
scm {
connection = "scm:git:https://github.com/kettingpowered/terminal-colors.git"
//developerConnection = "scm:svn:https://subversion.example.com/svn/project/trunk/"
url = "https://github.com/kettingpowered/terminal-colors"
}
}
}
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/kettingpowered/terminal-colors")
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/"
}
}
}
Empty file modified gradlew
100644 → 100755
Empty file.

0 comments on commit 9e2173d

Please sign in to comment.