This commit is contained in:
parent
4168f752a4
commit
55b30e02c2
2 changed files with 53 additions and 5 deletions
29
.forgejo/workflows/publish.yml
Normal file
29
.forgejo/workflows/publish.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
on: [ push ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
name: Build & Publish
|
||||||
|
|
||||||
|
runs-on: 'docker'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Setup Java
|
||||||
|
uses: https://github.com/actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
distribution: 'adopt'
|
||||||
|
java-version: 8
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
- name: Initialize Gradle
|
||||||
|
uses: https://github.com/gradle/actions/setup-gradle@v3
|
||||||
|
- name: Build
|
||||||
|
run: ./gradlew build
|
||||||
|
- name: Publish
|
||||||
|
run: VERSION=$(git rev-list --count HEAD) ./gradlew publish
|
||||||
|
env:
|
||||||
|
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
29
build.gradle
29
build.gradle
|
@ -6,10 +6,29 @@ plugins {
|
||||||
group = 'de.tudbut'
|
group = 'de.tudbut'
|
||||||
version = '1.0-SNAPSHOT'
|
version = '1.0-SNAPSHOT'
|
||||||
|
|
||||||
repositories {
|
publishing {
|
||||||
mavenCentral()
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
publications {
|
||||||
}
|
mavenJava(MavenPublication) {
|
||||||
|
groupId = "de.tudbut"
|
||||||
|
version = System.getenv("VERSION")
|
||||||
|
from components.java
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "Forgejo"
|
||||||
|
url = uri("https://git.tudbut.de/api/packages/TudbuT/maven")
|
||||||
|
|
||||||
|
credentials(HttpHeaderCredentials) {
|
||||||
|
name = "Authorization"
|
||||||
|
value = "token " + System.getenv("PUBLISH_TOKEN")
|
||||||
|
}
|
||||||
|
|
||||||
|
authentication {
|
||||||
|
header(HttpHeaderAuthentication)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue