diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cd2920b04..31b1cd16a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -164,23 +164,14 @@ jobs: ##### KOTLIN BUILD ##### build_kotlin: - runs-on: "ubuntu-22.04" + needs: setup_config + runs-on: "ubuntu-latest" steps: - uses: actions/checkout@v4 with: lfs: true - run: git lfs pull - uses: ./.github/workflows/kotlin - - tests_nuget_android: - needs: [nugets, setup_config] - runs-on: "ubuntu-22.04" - steps: - - uses: actions/checkout@v4 - with: - lfs: true - - run: git lfs pull - - uses: ./.github/workflows/tests/csharp/android #### CODE FORMATTING #### rust_code_format: diff --git a/.github/workflows/kotlin/action.yml b/.github/workflows/kotlin/action.yml index d0a7e27b1..37a7439ee 100644 --- a/.github/workflows/kotlin/action.yml +++ b/.github/workflows/kotlin/action.yml @@ -2,6 +2,18 @@ name: Build Kotlin Package runs: using: composite steps: + - name: Download Version File + uses: actions/download-artifact@v4 + with: + name: config.txt + + - name: Read Version and Set Gradle Property + shell: bash + id: setup + run: | + version=$(grep "version" config.txt | sed -E 's/version = "(.*)"/\1/') + echo "version=$version" >> $GITHUB_OUTPUT + - name: Installing dependencies shell: bash run: | @@ -58,8 +70,8 @@ runs: linker = \"$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android21-clang\"" >> ./.cargo/config.toml - name: Build - working-directory: ./wrappers/kotlin shell: bash + working-directory: ./wrappers/kotlin run: | export ANDROID_ROOT="/usr/local/lib/android" export ANDROID_SDK_ROOT="${ANDROID_ROOT}/sdk" @@ -71,9 +83,14 @@ runs: chmod +x gradlew ./gradlew test ./gradlew build + ./gradlew generatePomFileForMavenPublication + + - run: sed -i 's|.*|${{ steps.setup.outputs.version }}|' 'lib/build/publications/maven/pom-default.xml' + shell: bash + working-directory: ./wrappers/kotlin - - name: Kotlin Package - uses: actions/upload-artifact@v4 + - name: Upload Kotlin package + uses: actions/upload-artifact@v4.3.6 with: name: kotlin path: ./wrappers/kotlin/lib/build diff --git a/.github/workflows/release-others.yml b/.github/workflows/release-others.yml index c0d647864..5e84acc19 100644 --- a/.github/workflows/release-others.yml +++ b/.github/workflows/release-others.yml @@ -6,6 +6,10 @@ on: description: "Publish Rust Crate" required: true type: boolean + publish_kotlin: + description: "Publish Kotlin" + required: true + type: boolean publish_npm: description: "Publish NPM" required: true @@ -27,7 +31,7 @@ jobs: - name: Check out for Rust release uses: actions/checkout@v4 - with: + with: path: ./rust-release/ - name: Check out devolutions/actions @@ -42,15 +46,16 @@ jobs: uses: ./.github/workflows/toolbox-install with: github_token: ${{ secrets.DEVOLUTIONSBOT_TOKEN }} - - - name: Download Python Artifact + + - name: Download Artifact env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} CI: true - run: | + run: | dv github download-artifact python-wheels-linux . devolutions-crypto dv github download-artifact python-wheels-macos . devolutions-crypto dv github download-artifact python-wheels-windows . devolutions-crypto + dv github download-artifact kotlin . devolutions-crypto - name: Download NPM Artifact run: dv github download-artifact wasm . devolutions-crypto @@ -65,6 +70,7 @@ jobs: 7z x python-wheels-windows.zip -o./devolutions-crypto-wheels 7z x wasm.zip -o./devolutions-crypto-npm + 7z x kotlin.zip -o./devolutions-crypto-maven - name: Publish Rust Crate if: ${{ inputs.publish_crate_rust }} @@ -116,3 +122,14 @@ jobs: else twine upload --verbose -u "__token__" -p ${{ secrets.PYPI_OWNER_API_KEY }} ./devolutions-crypto-wheels/* fi + + - name: Publish Kotlin to Cloudsmith + if: ${{ inputs.publish_kotlin }} + run: | + pip install --upgrade cloudsmith-cli + + cloudsmith push maven devolutions/maven-public devolutions-crypto-maven/libs/lib.jar \ + --pom-file=devolutions-crypto-maven/publications/maven/pom-default.xml \ + env: + CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }} + diff --git a/wrappers/kotlin/gradlew b/wrappers/kotlin/gradlew old mode 100644 new mode 100755 diff --git a/wrappers/kotlin/lib/build.gradle.kts b/wrappers/kotlin/lib/build.gradle.kts index 85bbc11fd..e98c00fc5 100644 --- a/wrappers/kotlin/lib/build.gradle.kts +++ b/wrappers/kotlin/lib/build.gradle.kts @@ -11,6 +11,8 @@ plugins { // Apply the java-library plugin for API and implementation separation. `java-library` + + id("maven-publish") } repositories { @@ -46,8 +48,8 @@ java { tasks.named("test") { // Use JUnit Platform for unit tests. useJUnitPlatform() - - + + // Configure test logging to display results in stdout testLogging { events("passed", "skipped", "failed") @@ -55,3 +57,36 @@ tasks.named("test") { showStandardStreams = true } } + +publishing { + repositories { + maven { + name = "cloudsmith" + url = uri("https://maven.cloudsmith.io/devolutions/maven-public/") + credentials { + username = System.getenv("CLOUDSMITH_USERNAME") ?: "bot-devolutions" + password = System.getenv("CLOUDSMITH_API_KEY") + } + } + } + publications { + create("maven") { + groupId = "devolutions" + artifactId = "devolutions-crypto" + version = project.version.toString() + artifact(tasks["jar"]) + pom { + name.set("Devolutions Crypto") + description.set("Devolutions Cryptographic Library") + url.set("https://github.com/devolutions/devolutions-crypto") + + licenses { + license { + name.set("Apache License 2.0") + url.set("https://www.apache.org/licenses/LICENSE-2.0.html") + } + } + } + } + } +}