Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add kotlin publish to cloudsmith #329

Merged
merged 1 commit into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,23 +164,24 @@ 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
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:
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/kotlin/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down Expand Up @@ -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"
Expand All @@ -71,9 +83,14 @@ runs:
chmod +x gradlew
./gradlew test
./gradlew build
./gradlew generatePomFileForMavenPublication

- run: sed -i 's|<version>.*</version>|<version>${{ steps.setup.outputs.version }}</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
Expand Down
25 changes: 21 additions & 4 deletions .github/workflows/release-others.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 }}
Expand Down Expand Up @@ -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 }}

Empty file modified wrappers/kotlin/gradlew
100644 → 100755
Empty file.
39 changes: 37 additions & 2 deletions wrappers/kotlin/lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ plugins {

// Apply the java-library plugin for API and implementation separation.
`java-library`

id("maven-publish")
}

repositories {
Expand Down Expand Up @@ -46,12 +48,45 @@ java {
tasks.named<Test>("test") {
// Use JUnit Platform for unit tests.
useJUnitPlatform()


// Configure test logging to display results in stdout
testLogging {
events("passed", "skipped", "failed")
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
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<MavenPublication>("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")
}
}
}
}
}
}
Loading