diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c472c38..7322152e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,7 +43,7 @@ jobs: - uses: ./.github/actions/setup - run: ./gradlew iosSimulatorArm64Test - docs: + artifact-docs: runs-on: macos-latest steps: - uses: actions/checkout@v4 @@ -52,3 +52,29 @@ jobs: - uses: actions/upload-pages-artifact@v3 with: path: build/dokka/htmlMultiModule + + artifact-android-demo-app: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + - run: ./gradlew packageReleaseUniversalApk + - uses: actions/upload-artifact@v4 + with: + name: demo-app-debug + path: demo-app/build/outputs/apk/debug/demo-app-debug.apk + - uses: actions/upload-artifact@v4 + with: + name: demo-app-release-unsigned + path: demo-app/build/outputs/apk/release/demo-app-release-unsigned.apk + + publish-snapshot: + needs: [test-android, test-ios] + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + runs-on: macos-latest + permissions: + actions: write + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + - run: ./gradlew publishAllPublicationsToGitHubPackagesRepository diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index f3cd6c34..00000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Publish - -on: - workflow_dispatch: - -jobs: - build: - runs-on: macos-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/setup - - run: ./gradlew dokkaHtmlMultiModule - - uses: actions/upload-pages-artifact@v3 - with: - path: build/dokka/htmlMultiModule - - publish-docs: - runs-on: ubuntu-latest - needs: build - permissions: - pages: write - id-token: write - environment: - name: github-pages - url: ${{ steps.deploy.outputs.page_url }} - steps: - - uses: actions/deploy-pages@v4 - id: deploy diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..9d535f36 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,53 @@ +name: Release + +on: + workflow_dispatch: + +jobs: + maven: + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + - uses: crazy-max/ghaction-import-gpg@v6 + id: import-gpg + with: + gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} + passphrase: ${{ secrets.GPG_PASSPHRASE }} + - name: Transform GPG key + id: transform-gpg-key + env: + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + run: | + key="$( + echo "$GPG_PASSPHRASE" \ + | gpg --passphrase-fd 0 --export-secret-keys --armor '${{ steps.import-gpg.outputs.key_id }}' \ + | grep -v '\-\-' | grep -v '^=.' | tr -d '\n' + )" + echo "name=$key" >> $GITHUB_OUTPUT + - run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ steps.transform-gpg-key.outputs.key }} + ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ steps.import-gpg.outputs.key_id }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.GPG_PASSPHRASE }} + + pages: + needs: [maven] + runs-on: macos-latest + permissions: + pages: write + id-token: write + environment: + name: github-pages + url: ${{ steps.deploy-pages.outputs.page_url }} + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/setup + - run: ./gradlew dokkaHtmlMultiModule + - uses: actions/upload-pages-artifact@v3 + with: + path: build/dokka/htmlMultiModule + - uses: actions/deploy-pages@v4 + id: deploy-pages diff --git a/README.md b/README.md index 00cc170b..c2079319 100644 --- a/README.md +++ b/README.md @@ -11,14 +11,14 @@ TODO add animated screenshots here ## Usage -This library is published via (TODO). +This library is published via Maven Central (TODO), and snapshot builds are additionally available on GitHub Packages. In your Gradle version catalog, add: ```toml [libraries] # ... -maplibre-compose = { module = "dev.sargunv:maplibre-compose", version = "0.1.0" } +maplibre-compose = { module = "dev.sargunv:maplibre-compose", version = "(TODO)" } ``` In your Gradle build script, add: @@ -49,7 +49,7 @@ fun MyMapScreen() { } ``` -For full usage information, see the [demo app](./demo-app) and docs (TODO). +For full usage information, see the [demo app](./demo-app) and [docs](https://sargunv.github.io/maplibre-compose/). ## Status diff --git a/gradle.properties b/gradle.properties index 84574c90..8288e87f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,9 @@ kotlin.daemon.jvmargs=-Xmx2048M org.gradle.jvmargs=-Xmx2048M -Dfile.encoding=UTF-8 android.nonTransitiveRClass=true android.useAndroidX=true +SONATYPE_HOST=CENTRAL_PORTAL SONATYPE_AUTOMATIC_RELEASE=true +RELEASE_SIGNING_ENABLED=true POM_URL="https://github.com/sargunv/maplibre-compose/" POM_LICENSE_NAME="BSD-3-Clause" POM_LICENSE_URL="https://opensource.org/license/bsd-3-clause" diff --git a/iosApp/iosApp.xcodeproj/project.pbxproj b/iosApp/iosApp.xcodeproj/project.pbxproj index 47366ad8..3e5b694b 100644 --- a/iosApp/iosApp.xcodeproj/project.pbxproj +++ b/iosApp/iosApp.xcodeproj/project.pbxproj @@ -112,7 +112,6 @@ B92378962B6B1156000C7307 /* Frameworks */, 7555FF79242A565900829871 /* Resources */, FB29095E4E4AE33FC6A4F030 /* [CP] Embed Pods Frameworks */, - 1C3A49D067C3591792D532A0 /* [CP] Copy Pods Resources */, ); buildRules = ( ); @@ -170,23 +169,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 1C3A49D067C3591792D532A0 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-iosApp/Pods-iosApp-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 81EA16B41DBA59C4915ABE3F /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index d30849f1..2f170219 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -1 +1,21 @@ -subprojects { group = "dev.sargunv" } +plugins { id("maven-publish") } + +// TODO: https://docs.gradle.org/current/userguide/sharing_build_logic_between_subprojects.html + +subprojects { + apply(plugin = "maven-publish") + group = "dev.sargunv" + + publishing { + repositories { + maven { + name = "GitHubPackages" + setUrl("https://maven.pkg.github.com/sargunv/maplibre-compose") + credentials { + username = project.properties["GITHUB_USERNAME"]?.toString() + password = project.properties["GITHUB_TOKEN"]?.toString() + } + } + } + } +} diff --git a/lib/maplibre-compose/build.gradle.kts b/lib/maplibre-compose/build.gradle.kts index 1521a604..d6d0d890 100644 --- a/lib/maplibre-compose/build.gradle.kts +++ b/lib/maplibre-compose/build.gradle.kts @@ -1,6 +1,5 @@ @file:OptIn(ExperimentalKotlinGradlePluginApi::class, ExperimentalComposeLibrary::class) -import com.vanniktech.maven.publish.SonatypeHost import org.jetbrains.compose.ExperimentalComposeLibrary import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi import org.jetbrains.kotlin.gradle.dsl.JvmTarget @@ -42,7 +41,7 @@ kotlin { androidTarget { compilerOptions { jvmTarget.set(JvmTarget.JVM_11) } instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test) - publishLibraryVariants("release") + publishLibraryVariants("release", "debug") } iosArm64() iosSimulatorArm64() @@ -103,18 +102,9 @@ spotless { } mavenPublishing { - coordinates( - groupId = "${project.group}", - artifactId = project.name, - version = "${project.version}", - ) - pom { name = "MapLibre Compose" description = "Add interactive vector tile maps to your Compose app" url = "https://github.com/sargunv/maplibre-compose" } - - publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, true) - signAllPublications() }