Skip to content

Commit

Permalink
Set up publishing to GitHub Packages
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Apr 20, 2021
1 parent b09b4fb commit 8d762ea
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Publish package to GitHub Packages
on:
push
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Publish package
run: gradle publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

35 changes: 35 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ subprojects {
apply plugin: 'signing'
apply plugin: 'maven'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand Down Expand Up @@ -197,9 +198,43 @@ gradle.projectsEvaluated {
}
}

//'upload' vs. 'publish, see
//https://medium.com/dot-debug/deploying-artifacts-to-maven-using-gradle-b669acc1b6f8'
/*
task publish {
dependsOn tasks.uploadArchives
}
*/

publishing {
publications {
mavenArtifacts(MavenPublication) {
from components.java
afterEvaluate {
groupId = project.group
artifactId = project.name
}
}
}

repositories {
maven {
name = 'localEmbedded'
// run generated gradle task `./gradlew
// publishMavenArtifactsPublicationToLocalEmbeddedRepository`
// to publish all subprojects into the same local embedded repo:
url = "file://${rootDir}/build/repo"
}
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/metafacture/metafacture-core"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
}
}

Expand Down

0 comments on commit 8d762ea

Please sign in to comment.