Skip to content

Commit 84c3a63

Browse files
committed
Add GitHub action to build artifact
1 parent 2a4cb7a commit 84c3a63

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.github/workflows/publish.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build-and-test:
14+
runs-on: ubuntu-latest
15+
- uses: actions/checkout@v4
16+
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: '17'
21+
distribution: 'temurin'
22+
23+
- name: Setup Gradle
24+
uses: gradle/actions/setup-gradle@v3
25+
26+
- name: Publish package
27+
run: ./gradlew publish
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
COMMIT_SHA: ${{ vars.GITHUB_SHA }}

numbers/build.gradle.kts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
1+
import java.net.URI
2+
13
plugins {
24
alias(libs.plugins.org.jetbrains.kotlin.jvm)
35
id("java-library")
6+
id("maven-publish")
47
}
58

9+
group = "org.dicio"
10+
version = System.getenv("COMMIT_SHA")
11+
612
kotlin {
713
jvmToolchain(17)
814
}
@@ -11,3 +17,21 @@ dependencies {
1117
implementation(libs.nanojson)
1218
testImplementation(libs.junit)
1319
}
20+
21+
publishing {
22+
repositories {
23+
maven {
24+
name = "GitHubPackages"
25+
url = URI("https://maven.pkg.github.com/octocat/hello-world")
26+
credentials {
27+
username = System.getenv("GITHUB_ACTOR")
28+
password = System.getenv("GITHUB_TOKEN")
29+
}
30+
}
31+
}
32+
publications {
33+
create<MavenPublication>("mavenJava") {
34+
from(components["java"])
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)