mirror of
https://github.com/tcgdex/java-sdk.git
synced 2025-04-22 10:52:14 +00:00
chore: Add the ability to publish to Github packages
Signed-off-by: Avior <github@avior.me>
This commit is contained in:
parent
238c215d35
commit
7c7ca1742b
22
.github/workflows/build.yml
vendored
22
.github/workflows/build.yml
vendored
@ -5,34 +5,36 @@
|
|||||||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
|
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
|
||||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
||||||
|
|
||||||
name: Java CI with Gradle
|
name: Build & test the project
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ master ]
|
branches:
|
||||||
|
- master
|
||||||
|
# Run on any pull request
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ master ]
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
# follows https://en.wikipedia.org/wiki/Java_version_history#Release_table
|
# follows https://en.wikipedia.org/wiki/Java_version_history#Release_table
|
||||||
java-versions: ['8', '11', '17', '21']
|
java-versions: ['8', '11', '17', '21']
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Set up Java ${{ matrix.java-versions }}
|
- name: Set up Java ${{ matrix.java-versions }}
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: ${{ matrix.java-versions }}
|
java-version: ${{ matrix.java-versions }}
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
- name: Build with Gradle
|
|
||||||
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
|
- name: Build & Test
|
||||||
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
arguments: build
|
arguments: build test
|
||||||
|
19
.github/workflows/publish.yml
vendored
19
.github/workflows/publish.yml
vendored
@ -9,35 +9,34 @@ name: Gradle Package
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types:
|
||||||
|
- created
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- name: Checkout
|
||||||
- name: Set up JDK 11
|
uses: actions/checkout@v3
|
||||||
|
- name: Set up JDK 8
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
java-version: '11'
|
java-version: '8' # use the lowest version from https://en.wikipedia.org/wiki/Java_version_history#Release_table
|
||||||
distribution: 'temurin'
|
distribution: 'temurin'
|
||||||
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
|
||||||
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
settings-path: ${{ github.workspace }} # location for the settings.xml file
|
||||||
|
|
||||||
- name: Build with Gradle
|
- name: Build the project
|
||||||
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
arguments: build
|
arguments: build
|
||||||
|
|
||||||
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
|
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
|
||||||
# the publishing section of your build.gradle
|
# the publishing section of your build.gradle
|
||||||
- name: Publish to GitHub Packages
|
- name: Publish to GitHub Packages
|
||||||
uses: gradle/gradle-build-action@fec4a42eb0c83154e5c9590748ba8337949c5701
|
uses: gradle/gradle-build-action@v2
|
||||||
with:
|
with:
|
||||||
arguments: publish
|
arguments: publish
|
||||||
env:
|
env:
|
||||||
|
@ -85,5 +85,45 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
register<MavenPublication>("gpr") {
|
||||||
|
// groupId = group
|
||||||
|
artifactId = artifact
|
||||||
|
// version = ver
|
||||||
|
|
||||||
|
from(components["java"])
|
||||||
|
|
||||||
|
pom {
|
||||||
|
name.set("TCGdex SDK")
|
||||||
|
description.set("Communicate with the Open Source TCGdex API in Kotlin/Java using the SDK")
|
||||||
|
url.set("https://github.com/tcgdex/java-sdk")
|
||||||
|
licenses {
|
||||||
|
license {
|
||||||
|
name.set("MIT License")
|
||||||
|
url.set("https://github.com/tcgdex/java-sdk/blob/master/LICENSE.txt")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
developers {
|
||||||
|
developer {
|
||||||
|
id.set("avior")
|
||||||
|
name.set("Avior")
|
||||||
|
email.set("contact@tcgdex.net")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
scm {
|
||||||
|
connection.set("scm:git@github.com:tcgdex/java-sdk.git")
|
||||||
|
url.set("https://github.com/tcgdex/java-sdk")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "GithubPackages"
|
||||||
|
url = uri("https://maven.pkg.github.com/tcgdex/java-sdk")
|
||||||
|
credentials {
|
||||||
|
username = project.findProperty("gpr.user") as String? ?: System.getenv("USERNAME")
|
||||||
|
password = project.findProperty("gpr.key") as String? ?: System.getenv("TOKEN")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user