diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 9854a70..b10f9d2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -122,3 +122,22 @@ jobs: - name: Run pytest run: pytest tests/ + + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v3 + + - name: Publish package + run: cd java && ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/java/lib/build.gradle b/java/lib/build.gradle index 3aae4e5..46f6e8d 100644 --- a/java/lib/build.gradle +++ b/java/lib/build.gradle @@ -1,6 +1,7 @@ plugins { id('java-library') id('com.google.protobuf') version "0.9.4" + id('maven-publish') } repositories { @@ -51,3 +52,16 @@ java { tasks.named('test') { useJUnitPlatform() } + +publishing { + repositories { + maven { + name = "GitHubPackages" + url = "https://maven.pkg.github.com/adf-python/adf-core-python" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } +} \ No newline at end of file