ci: added ci

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2024-05-07 13:51:17 +02:00
parent 68e9eeceb6
commit e80e798482
Signed by: moonleay
GPG key ID: 82667543CCD715FB
2 changed files with 30 additions and 7 deletions

View file

@ -0,0 +1,22 @@
on:
push:
jobs:
release:
runs-on: selfhosted
steps:
- uses: actions/checkout@v3
name: Checkout
- uses: https://github.com/actions/setup-java@v4
name: Setup Java
with:
distribution: temurin
java-version: 17
- uses: https://github.com/gradle/actions/setup-gradle@v3
name: Setup Gradle
- run: ./gradlew runDatagen
name: Generate assets
- run: ./gradlew build
name: Build Project
- run: ./gradlew publish
name: Upload

View file

@ -184,17 +184,18 @@ publishing {
}
repositories {
if (System.getenv("CI_JOB_TOKEN") != null) {
if (System.getenv("CI") != null) {
maven {
name = "GitLab"
val projectId = System.getenv("CI_PROJECT_ID")
val apiV4 = System.getenv("CI_API_V4_URL")
url = uri("$apiV4/projects/$projectId/packages/maven")
name = "Codeberg"
val repoOwner = System.getenv("GITHUB_REPOSITORY_OWNER")
val apiEndpoint = System.getenv("GITHUB_API_URL")
url = uri("$apiEndpoint/packages/$repoOwner/maven")
authentication {
create("token", HttpHeaderAuthentication::class.java) {
val accessToken = System.getenv("GITHUB_TOKEN")
credentials(HttpHeaderCredentials::class.java) {
name = "Job-Token"
value = System.getenv("CI_JOB_TOKEN")
name = "Authorization"
value = "token $accessToken"
}
}
}