From f211701eace516654a5e1ee77a9447f3f9a3f571 Mon Sep 17 00:00:00 2001 From: Aleksander Nowakowski Date: Fri, 8 Mar 2024 12:08:31 +0100 Subject: [PATCH] GitHub Actions --- .github/workflows/deploy-to-nexus.yml | 33 +++++++++++++++++++++++++++ Gemfile | 3 +++ build.gradle.kts | 9 ++++++++ fastlane/Fastfile | 30 ++++++++++++++++++++++++ gradle/libs.versions.toml | 2 ++ 5 files changed, 77 insertions(+) create mode 100644 .github/workflows/deploy-to-nexus.yml create mode 100644 Gemfile create mode 100644 fastlane/Fastfile diff --git a/.github/workflows/deploy-to-nexus.yml b/.github/workflows/deploy-to-nexus.yml new file mode 100644 index 0000000..b99e9aa --- /dev/null +++ b/.github/workflows/deploy-to-nexus.yml @@ -0,0 +1,33 @@ +name: Deploy to Nexus +on: + push: + tags: + - '*' + workflow_dispatch: +jobs: + deployToNexus: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: actions/setup-java@v4 + with: + distribution: 'corretto' + java-version: '17' + - shell: bash + env: + # The following env variables are used by gradle/publish-module.gradle + GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }} + GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }} + # The following env variables are used by gradle/publish-root.gradle.kts + OSSR_USERNAME: ${{ secrets.OSSR_USERNAME }} + OSSR_PASSWORD: ${{ secrets.OSSR_PASSWORD }} + SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }} + # The script generates sec.gpg file that is required by gradle/publish-module.gradle + # and starts :deployNexus lane using fastlane. + run: | + java --version + echo "${{ secrets.GPG_FILE }}" > sec.gpg.asc + gpg -d --passphrase "${{ secrets.GPG_FILE_PSWD }}" --batch sec.gpg.asc > sec.gpg + fastlane deployNexus diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..112d398 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'fastlane' \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index 0d04cf7..5688136 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,13 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { alias(libs.plugins.kotlin.jvm) apply false + alias(libs.plugins.kotlin.dokka) +} + +subprojects { + apply(plugin = "org.jetbrains.dokka") +} + +tasks.dokkaHtmlMultiModule.configure { + outputDirectory.set(rootDir.resolve("docs")) } \ No newline at end of file diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000..5aef565 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,30 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +default_platform(:android) + +platform :android do + + desc "Deploy libraries to Nexus." + lane :deployNexus do + gradle(task: "publish") + # gradle(task: "releaseStagingRepositories") + end + + desc "Generate docs." + lane :generateDocs do + gradle(task: "dokkaHtmlMultiModule") + end +end diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 40fa567..6c343e5 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,6 +2,7 @@ kotlin = "1.9.23" nordicPlugins = "2.0.0" +dokkaPlugin = "1.9.20" [libraries] kotlin-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", version.ref = "kotlin" } @@ -9,4 +10,5 @@ kotlin-junit = { group = "org.jetbrains.kotlin", name = "kotlin-test-junit", ver [plugins] nordic-nexus-kotlin = { id = "no.nordicsemi.kotlin.gradle.nexus", version.ref = "nordicPlugins" } kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" } +kotlin-dokka = { id = "org.jetbrains.dokka", version.ref = "dokkaPlugin" }