diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 00000000..b38b6b70 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,44 @@ +name: Publish to GitHub Packages + +on: [ push, pull_request ] + +jobs: + build-job: + runs-on: ubuntu-latest # enables hardware acceleration in the virtual machine + timeout-minutes: 30 + + permissions: + contents: write + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Copy CI gradle.properties + run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: 17 + + + - name: Print git commit variables + run: | + echo "TAG: $CURRENT_TAG" + + - name: Copy CI gradle.properties + run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties + + - name: Build + run: ./gradlew --stacktrace clean assemble + + - name: Setup Gradle + uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0 + + - name: Publish package + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/convention-plugins/src/main/kotlin/module.publication.gradle.kts b/convention-plugins/src/main/kotlin/module.publication.gradle.kts index 02e645af..ae5b99eb 100644 --- a/convention-plugins/src/main/kotlin/module.publication.gradle.kts +++ b/convention-plugins/src/main/kotlin/module.publication.gradle.kts @@ -8,6 +8,16 @@ plugins { } publishing { + repositories { + maven { + name = "GitHubPackages" + url = uri("https://maven.pkg.github.com/sk-ai-net/skainet") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } // Configure all publications publications.withType { // Stub javadoc.jar artifact @@ -19,7 +29,6 @@ publishing { // Provide artifacts information required by Maven Central pom { name.set("skainet - Kotlin Multiplatform library") - licenses { license { name.set("MIT")