Skip to content

Commit

Permalink
iterate publishing config (untested)
Browse files Browse the repository at this point in the history
  • Loading branch information
sargunv committed Nov 24, 2024
1 parent 12092b3 commit 9c168c0
Show file tree
Hide file tree
Showing 8 changed files with 107 additions and 62 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- uses: ./.github/actions/setup
- run: ./gradlew iosSimulatorArm64Test

docs:
artifact-docs:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -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
28 changes: 0 additions & 28 deletions .github/workflows/publish.yml

This file was deleted.

53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
18 changes: 0 additions & 18 deletions iosApp/iosApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
B92378962B6B1156000C7307 /* Frameworks */,
7555FF79242A565900829871 /* Resources */,
FB29095E4E4AE33FC6A4F030 /* [CP] Embed Pods Frameworks */,
1C3A49D067C3591792D532A0 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
Expand Down Expand Up @@ -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;
Expand Down
22 changes: 21 additions & 1 deletion lib/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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()
}
}
}
}
}
12 changes: 1 addition & 11 deletions lib/maplibre-compose/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -42,7 +41,7 @@ kotlin {
androidTarget {
compilerOptions { jvmTarget.set(JvmTarget.JVM_11) }
instrumentedTestVariant.sourceSetTree.set(KotlinSourceSetTree.test)
publishLibraryVariants("release")
publishLibraryVariants("release", "debug")
}
iosArm64()
iosSimulatorArm64()
Expand Down Expand Up @@ -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()
}

0 comments on commit 9c168c0

Please sign in to comment.