diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..e856c585 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,18 @@ +name: Publish package to GitHub Packages +on: + push: + branches: + - 'publish' +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 }} + diff --git a/build.gradle b/build.gradle index f3ebaae3..4e59e7a2 100644 --- a/build.gradle +++ b/build.gradle @@ -43,6 +43,7 @@ subprojects { apply plugin: 'eclipse' apply plugin: 'java' apply plugin: 'org.xtext.builder' + apply plugin: 'maven-publish' apply from: "${rootDir}/gradle/source-layout.gradle" @@ -73,6 +74,35 @@ subprojects { options.compilerArgs << '-Werror' } + + 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-fix" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } + } } task installServer(type: Copy) {