Skip to content

Commit 287c58d

Browse files
authored
Publishing workflow (#2)
1 parent 444611c commit 287c58d

File tree

4 files changed

+62
-1
lines changed

4 files changed

+62
-1
lines changed

.github/workflows/checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout latest code
13-
uses: actions/checkout@v2
13+
uses: actions/checkout@v3
1414

1515
- name: Set up JDK 11
1616
uses: actions/setup-java@v3

.github/workflows/publish.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout latest code
13+
uses: actions/checkout@v3
14+
15+
- name: Set up JDK 11
16+
uses: actions/setup-java@v3
17+
with:
18+
distribution: "adopt"
19+
java-version: 11
20+
21+
- name: Setup build cache
22+
uses: actions/[email protected]
23+
with:
24+
path: ~/.gradle/caches
25+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle.kts') }}
26+
restore-keys: |
27+
${{ runner.os }}-gradle-
28+
29+
- name: Publish artifact
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
33+
run: |
34+
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
35+
echo "New version: ${NEW_VERSION}"
36+
echo "Github username: ${GITHUB_ACTOR}"
37+
./gradlew -Pversion=${NEW_VERSION} publish

gradle.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
group=com.featurevisor
2+
version=0.0.1-SNAPSHOT

lib/build.gradle.kts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,35 @@ plugins {
1111

1212
// Apply the java-library plugin for API and implementation separation.
1313
`java-library`
14+
15+
`maven-publish`
1416
}
1517

1618
repositories {
1719
// Use Maven Central for resolving dependencies.
1820
mavenCentral()
1921
}
2022

23+
publishing {
24+
publications {
25+
create<MavenPublication>("default") {
26+
from(components["java"])
27+
// Include any other artifacts here, like javadocs
28+
}
29+
}
30+
31+
repositories {
32+
maven {
33+
name = "GitHubPackages"
34+
url = uri("https://maven.pkg.github.com/featurevisor/featurevisor-kotlin")
35+
credentials {
36+
username = System.getenv("GITHUB_ACTOR")
37+
password = System.getenv("GITHUB_TOKEN")
38+
}
39+
}
40+
}
41+
}
42+
2143
dependencies {
2244
// Use the Kotlin JUnit 5 integration.
2345
testImplementation("org.jetbrains.kotlin:kotlin-test-junit5")

0 commit comments

Comments
 (0)