Skip to content

Commit 54b8e9f

Browse files
committed
Publish to github packages
1 parent 5c6a439 commit 54b8e9f

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

.github/workflows/build-package.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
pull_request:
6+
branches:
7+
- master
8+
jobs:
9+
# Build the gradle jar
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 11
19+
- name: Build with Gradle
20+
run: ./gradlew build
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
on:
2+
push:
3+
branches:
4+
- master
5+
jobs:
6+
publish-jar:
7+
needs: build
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v2
12+
- name: Set up JDK 11
13+
uses: actions/setup-java@v1
14+
with:
15+
java-version: 11
16+
- name: Publish to GitHub Packages
17+
run: ./gradlew build publish
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

build.gradle.kts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
plugins {
22
`java-library`
3+
`maven-publish`
34
}
45

56
group = "com.github.jsixface"
@@ -18,3 +19,21 @@ dependencies {
1819
implementation(libs.snakeyaml)
1920
testImplementation(libs.junit)
2021
}
22+
23+
publishing {
24+
publications {
25+
create<MavenPublication>("mavenJava") {
26+
from(components["java"])
27+
}
28+
}
29+
repositories {
30+
maven {
31+
name = "GitHubPackages"
32+
url = uri("https://maven.pkg.github.com/jsixface/yamlconfig")
33+
credentials {
34+
username = System.getenv("GITHUB_ACTOR")
35+
password = System.getenv("GITHUB_TOKEN")
36+
}
37+
}
38+
}
39+
}

0 commit comments

Comments
 (0)