From 683a6e1baeee6d36695202fadd9082cf3e99856a Mon Sep 17 00:00:00 2001 From: Darius Maitia Date: Tue, 17 Oct 2023 15:56:22 +0200 Subject: [PATCH] Adding publishing github workflow (#10) * Adding publishing work to release workflow * Adding publish workflow --- .github/workflows/publish.yml | 60 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 1 - zenoh-kotlin/build.gradle.kts | 15 ++++++++- 3 files changed, 74 insertions(+), 2 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 00000000..32ebe934 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,60 @@ +name: Publish + +on: + release: + types: [published] + schedule: + - cron: "0 1 * * 1-5" + workflow_dispatch: + +env: + CARGO_TERM_COLOR: always + +jobs: + publish_android_package: + name: Publish Android Package to Github Packages + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 11 + + - uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r26 + add-to-path: false + link-to-sdk: true + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + override: true + components: rustfmt, clippy + + - name: Setup Rust toolchains + run: | + rustup target add armv7-linux-androideabi + rustup target add i686-linux-android + rustup target add aarch64-linux-android + rustup target add x86_64-linux-android + + - name: Gradle Wrapper + run: | + gradle wrapper + + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@v1 + + - name: Gradle Publish Android Package + uses: gradle/gradle-build-action@v2 + with: + arguments: publishAndroidReleasePublicationToGithubPackagesRepository + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 34987b56..d02b36a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -71,4 +71,3 @@ jobs: with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./zenoh-kotlin/build/dokka/html - diff --git a/zenoh-kotlin/build.gradle.kts b/zenoh-kotlin/build.gradle.kts index 031d4e5f..ca77049c 100644 --- a/zenoh-kotlin/build.gradle.kts +++ b/zenoh-kotlin/build.gradle.kts @@ -88,9 +88,22 @@ kotlin { } androidTarget { publishLibraryVariants("release") + publishing { + repositories { + maven { + name = "GithubPackages" + url = uri("https://maven.pkg.github.com/eclipse-zenoh/zenoh-kotlin") + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } + } + } } - @Suppress("Unused") sourceSets { + @Suppress("Unused") + sourceSets { val commonMain by getting { dependencies { implementation("commons-net:commons-net:3.9.0")