From b7ba4300f56ebbf0fc6916b3486209d069165bb3 Mon Sep 17 00:00:00 2001 From: altrisi Date: Sat, 28 Jan 2023 20:19:08 +0100 Subject: [PATCH] Setup publishing to Github Packages --- .github/workflows/publish.yml | 24 ++++++++++++++++++++++++ build.gradle | 27 ++++++++++++++++++++++++--- 2 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..82957c0 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,24 @@ +name: Publish package to GitHub Packages +on: + release: + types: [published] +jobs: + Publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: 17 + cache: 'gradle' + - name: Grant execute permission to gradlew + run: chmod +x gradlew + - name: Publish package + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index bb14c06..e2050e8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,8 @@ plugins { - id 'java' - id 'java-library' + id 'java' + id 'java-library' + id 'eclipse' + id 'maven-publish' } archivesBaseName = 'sisaassembler' @@ -18,5 +20,24 @@ java { } test { - useJUnitPlatform() + useJUnitPlatform() } + +publishing { + publications { + mavenJava(MavenPublication) { + from components.java + artifactId = 'sisaassembler' + } + } + repositories { + maven { + name = "GitHubPackages" + url = "https://maven.pkg.github.com/illogicworks/sisaj" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file