Skip to content

Commit 8d762ea

Browse files
committed
Set up publishing to GitHub Packages
See: #356 https://gitlab.com/oersi/oersi-etl/-/issues/59
1 parent b09b4fb commit 8d762ea

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

.github/workflows/publish.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Publish package to GitHub Packages
2+
on:
3+
push
4+
jobs:
5+
publish:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- uses: actions/setup-java@v1
10+
with:
11+
java-version: 1.8
12+
- name: Publish package
13+
run: gradle publish
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+

build.gradle

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ subprojects {
4242
apply plugin: 'signing'
4343
apply plugin: 'maven'
4444
apply plugin: 'jacoco'
45+
apply plugin: 'maven-publish'
4546

4647
sourceCompatibility = 1.8
4748
targetCompatibility = 1.8
@@ -197,9 +198,43 @@ gradle.projectsEvaluated {
197198
}
198199
}
199200

201+
//'upload' vs. 'publish, see
202+
//https://medium.com/dot-debug/deploying-artifacts-to-maven-using-gradle-b669acc1b6f8'
203+
/*
200204
task publish {
201205
dependsOn tasks.uploadArchives
202206
}
207+
*/
208+
209+
publishing {
210+
publications {
211+
mavenArtifacts(MavenPublication) {
212+
from components.java
213+
afterEvaluate {
214+
groupId = project.group
215+
artifactId = project.name
216+
}
217+
}
218+
}
219+
220+
repositories {
221+
maven {
222+
name = 'localEmbedded'
223+
// run generated gradle task `./gradlew
224+
// publishMavenArtifactsPublicationToLocalEmbeddedRepository`
225+
// to publish all subprojects into the same local embedded repo:
226+
url = "file://${rootDir}/build/repo"
227+
}
228+
maven {
229+
name = "GitHubPackages"
230+
url = "https://maven.pkg.github.com/metafacture/metafacture-core"
231+
credentials {
232+
username = System.getenv("GITHUB_ACTOR")
233+
password = System.getenv("GITHUB_TOKEN")
234+
}
235+
}
236+
}
237+
}
203238
}
204239
}
205240

0 commit comments

Comments
 (0)