Skip to content

A template project to jumpstart the creation and publishing of new Kotlin multiplatform libraries.

License

Notifications You must be signed in to change notification settings

christian-draeger/kotlin-library-template

Repository files navigation

Kotlin Library Template CI Maven Central Version

A universal Kotlin library template designed to kickstart your Kotlin library projects with ease. This template provides a robust and scalable foundation for library development, with built-in automation tools to guide you from initial setup to publishing your library effortlessly.

🚀 Features

  • Quick Start: No complex setup required. Simply fork this template, adjust the settings, and start coding.
  • Modular Structure: Designed from the ground up to support splitting your library into multiple smaller libraries, enabling more granular access and flexibility for users of your project.
  • Powered by Kotlin Multiplatform: Offers full flexibility in choosing your target platforms
  • Automated Publishing: Fully configured Gradle setup for publishing to Maven Central or other package repositories.
  • Best Practices Included:
  • CI/CD Ready: Preconfigured GitHub Actions workflows for seamless builds and releases.

📦 Benefits of the Automated Publisher

This template comes with a powerful automated publishing system:

  1. Secure Configuration:

    • Handles sensitive data such as access tokens securely through environment variables.
    • Built-in support for CI/CD workflows ensures safe and consistent deployments.
  2. Automatic Versioning:

    • Semantic Versioning is automatically managed based on tags or commit messages.
    • No manual updates required in your build.gradle.kts.

🛠️ Installation and Usage

  1. Use the Template:

    • Fork the repository or use it directly as a GitHub Template.
    • Customize settings.gradle.kts and build.gradle.kts to suit your project.
  2. Adjust Modules:

    • Modify the core and example modules, or add new ones to expand functionality.
  3. Automated Releases:

    • Use GitHub Actions for automated CI/CD workflows.
      • The GitHub action requires the following secrets to be set in your project settings to be able to publish to Maven Central:
        • MAVEN_CENTRAL_USERNAME
        • MAVEN_CENTRAL_PASSWORD
        • SIGNING_IN_MEMORY_KEY
        • SIGNING_IN_MEMORY_KEY_ID
        • SIGNING_IN_MEMORY_KEY_PASSWORD
      • You can find more information about how to get the required maven central credentials here or here or in the official documentation.
    • Publishing To Maven Local:
      • ./gradlew publishToMavenLocal

🤖 Preconfigured CI/CD Workflows

This template includes ready-to-use GitHub Actions workflows for:

  • Build & Test: Ensures your library is reliable and bug-free.
  • Release: Automatically publishes new versions when a release tag is created.
  • Linting: Keeps your code clean and adherent to Kotlin standards.

⚡️ Troubleshooting

How to get the signing key

Please change the <key id> placeholder in the following command to your signing key id.

gpg --export-secret-keys --armor <key id> | grep -v '\-\-' | grep -v '^=.' | tr -d '\n'

📄 License

This repository is licensed under the MIT License.


With this template, you can focus on writing great code while the boilerplate tasks are taken care of. Happy coding! 🎉

About

A template project to jumpstart the creation and publishing of new Kotlin multiplatform libraries.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages