Skip to content
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
50 changes: 47 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,25 @@ jobs:
fi
echo "color=$COLOR" >> "$GITHUB_OUTPUT"

- name: Read version from gradle.properties
id: version
run: |
VERSION=$(grep 'jsoncmp.version=' gradle.properties | cut -d= -f2)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Update README badges
run: |
COVERAGE=${{ needs.test-and-coverage.outputs.coverage }}
COLOR=${{ steps.badge.outputs.color }}
REPO=${{ github.repository }}
VERSION=${{ steps.version.outputs.version }}

BUILD_BADGE="[![Build](https://github.com/${REPO}/actions/workflows/main.yml/badge.svg)](https://github.com/${REPO}/actions/workflows/main.yml)"
COVERAGE_BADGE="[![Coverage](https://img.shields.io/badge/coverage-${COVERAGE}%25-${COLOR})](https://github.com/${REPO}/actions/workflows/main.yml)"
BUILD_BADGE="[![Build](https://github.com/${REPO}/actions/workflows/deploy.yml/badge.svg)](https://github.com/${REPO}/actions/workflows/deploy.yml)"
COVERAGE_BADGE="[![Coverage](https://img.shields.io/badge/coverage-${COVERAGE}%25-${COLOR})](https://github.com/${REPO}/actions/workflows/deploy.yml)"
VERSION_ESCAPED=$(echo "$VERSION" | sed 's/-/--/g')
MAVEN_BADGE="[![Maven](https://img.shields.io/badge/maven-${VERSION_ESCAPED}-blue)](https://github.com/${REPO}/packages)"

BADGE_LINE="${BUILD_BADGE} ${COVERAGE_BADGE}"
BADGE_LINE="${BUILD_BADGE} ${COVERAGE_BADGE} ${MAVEN_BADGE}"

if grep -q '^\[!\[Build\]' README.md; then
sed -i "1,/^\[!\[Build\]/s|^\[!\[Build\].*|${BADGE_LINE}|" README.md
Expand All @@ -105,6 +114,12 @@ jobs:
sed -i "1a\\\\${BADGE_LINE}\n" README.md
fi

- name: Update version in README and docs
run: |
VERSION=${{ steps.version.outputs.version }}
sed -i "s|implementation(\"dev.skymansandy:json-cmp:[^\"]*\")|implementation(\"dev.skymansandy:json-cmp:${VERSION}\")|" README.md
find docs -name '*.md' -exec sed -i "s|implementation(\"dev.skymansandy:json-cmp:[^\"]*\")|implementation(\"dev.skymansandy:json-cmp:${VERSION}\")|" {} +

- name: Commit badge updates
run: |
git config user.name "github-actions[bot]"
Expand Down Expand Up @@ -164,3 +179,32 @@ jobs:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

github-release:
name: GitHub Release
needs: [publish, update-badges]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Read version from gradle.properties
id: version
run: |
VERSION=$(grep 'jsoncmp.version=' gradle.properties | cut -d= -f2)
echo "version=$VERSION" >> "$GITHUB_OUTPUT"

- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=${{ steps.version.outputs.version }}
TAG="v${VERSION}"

if gh release view "$TAG" > /dev/null 2>&1; then
echo "Release $TAG already exists, skipping."
else
gh release create "$TAG" \
--title "$TAG" \
--generate-notes \
--target main
fi
23 changes: 21 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# JsonCMP
[![Build](https://github.com/skymansandy/jsonCMP/actions/workflows/main.yml/badge.svg)](https://github.com/skymansandy/jsonCMP/actions/workflows/main.yml) [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://github.com/skymansandy/jsonCMP/actions/workflows/main.yml)
[![Build](https://github.com/skymansandy/jsonCMP/actions/workflows/deploy.yml/badge.svg)](https://github.com/skymansandy/jsonCMP/actions/workflows/deploy.yml) [![Coverage](https://img.shields.io/badge/coverage-100%25-brightgreen)](https://github.com/skymansandy/jsonCMP/actions/workflows/deploy.yml) [![Maven](https://img.shields.io/badge/maven-1.0.0--alpha2-blue)](https://github.com/skymansandy/jsonCMP/packages)


Kotlin Multiplatform Compose JSON viewer and editor component for Android, iOS, and JVM Desktop.
Expand All @@ -14,10 +14,29 @@ Kotlin Multiplatform Compose JSON viewer and editor component for Android, iOS,

## Installation

Add the GitHub Packages repository to your `settings.gradle.kts`:

```kotlin
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
maven {
url = uri("https://maven.pkg.github.com/skymansandy/jsonCMP")
credentials {
username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_USERNAME")
password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
}
}
}
}
```

Then add the dependency:

```kotlin
// build.gradle.kts
dependencies {
implementation("dev.skymansandy:json-cmp:<version>")
implementation("dev.skymansandy:json-cmp:1.0.0-alpha2")
}
```

Expand Down
27 changes: 25 additions & 2 deletions docs/getting-started/installation.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Installation

## Repository Setup

JsonCMP is published to GitHub Packages. Add the repository to your `settings.gradle.kts`:

```kotlin
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
maven {
url = uri("https://maven.pkg.github.com/skymansandy/jsonCMP")
credentials {
username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_USERNAME")
password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
}
}
}
}
```

> **Note:** GitHub Packages requires authentication. Add `gpr.user` and `gpr.key` to your
> `~/.gradle/gradle.properties` or set `GITHUB_USERNAME` and `GITHUB_TOKEN` environment variables.
> The token needs the `read:packages` scope.

## Gradle (Kotlin DSL)

Add the dependency to your KMP module:
Expand All @@ -11,7 +34,7 @@ Add the dependency to your KMP module:
kotlin {
sourceSets {
commonMain.dependencies {
implementation("dev.skymansandy:json-cmp:<version>")
implementation("dev.skymansandy:json-cmp:1.0.0-alpha2")
}
}
}
Expand All @@ -22,7 +45,7 @@ Add the dependency to your KMP module:
```kotlin
// build.gradle.kts
dependencies {
implementation("dev.skymansandy:json-cmp:<version>")
implementation("dev.skymansandy:json-cmp:1.0.0-alpha2")
}
```

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ android.r8.strictFullModeForKeepRules=false

#Publishing
jsoncmp.group=dev.skymansandy
jsoncmp.version=1.0.0-alpha2
jsoncmp.version=1.0.0-alpha1
Loading