Skip to content

Commit d0c2690

Browse files
authored
Update README (#2)
1 parent 5fb8243 commit d0c2690

4 files changed

Lines changed: 94 additions & 8 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 47 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,16 +86,25 @@ jobs:
8686
fi
8787
echo "color=$COLOR" >> "$GITHUB_OUTPUT"
8888
89+
- name: Read version from gradle.properties
90+
id: version
91+
run: |
92+
VERSION=$(grep 'jsoncmp.version=' gradle.properties | cut -d= -f2)
93+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
94+
8995
- name: Update README badges
9096
run: |
9197
COVERAGE=${{ needs.test-and-coverage.outputs.coverage }}
9298
COLOR=${{ steps.badge.outputs.color }}
9399
REPO=${{ github.repository }}
100+
VERSION=${{ steps.version.outputs.version }}
94101
95-
BUILD_BADGE="[![Build](https://github.com/${REPO}/actions/workflows/main.yml/badge.svg)](https://github.com/${REPO}/actions/workflows/main.yml)"
96-
COVERAGE_BADGE="[![Coverage](https://img.shields.io/badge/coverage-${COVERAGE}%25-${COLOR})](https://github.com/${REPO}/actions/workflows/main.yml)"
102+
BUILD_BADGE="[![Build](https://github.com/${REPO}/actions/workflows/deploy.yml/badge.svg)](https://github.com/${REPO}/actions/workflows/deploy.yml)"
103+
COVERAGE_BADGE="[![Coverage](https://img.shields.io/badge/coverage-${COVERAGE}%25-${COLOR})](https://github.com/${REPO}/actions/workflows/deploy.yml)"
104+
VERSION_ESCAPED=$(echo "$VERSION" | sed 's/-/--/g')
105+
MAVEN_BADGE="[![Maven](https://img.shields.io/badge/maven-${VERSION_ESCAPED}-blue)](https://github.com/${REPO}/packages)"
97106
98-
BADGE_LINE="${BUILD_BADGE} ${COVERAGE_BADGE}"
107+
BADGE_LINE="${BUILD_BADGE} ${COVERAGE_BADGE} ${MAVEN_BADGE}"
99108
100109
if grep -q '^\[!\[Build\]' README.md; then
101110
sed -i "1,/^\[!\[Build\]/s|^\[!\[Build\].*|${BADGE_LINE}|" README.md
@@ -105,6 +114,12 @@ jobs:
105114
sed -i "1a\\\\${BADGE_LINE}\n" README.md
106115
fi
107116
117+
- name: Update version in README and docs
118+
run: |
119+
VERSION=${{ steps.version.outputs.version }}
120+
sed -i "s|implementation(\"dev.skymansandy:json-cmp:[^\"]*\")|implementation(\"dev.skymansandy:json-cmp:${VERSION}\")|" README.md
121+
find docs -name '*.md' -exec sed -i "s|implementation(\"dev.skymansandy:json-cmp:[^\"]*\")|implementation(\"dev.skymansandy:json-cmp:${VERSION}\")|" {} +
122+
108123
- name: Commit badge updates
109124
run: |
110125
git config user.name "github-actions[bot]"
@@ -164,3 +179,32 @@ jobs:
164179
- name: Deploy to GitHub Pages
165180
id: deployment
166181
uses: actions/deploy-pages@v4
182+
183+
github-release:
184+
name: GitHub Release
185+
needs: [publish, update-badges]
186+
runs-on: ubuntu-latest
187+
steps:
188+
- uses: actions/checkout@v4
189+
190+
- name: Read version from gradle.properties
191+
id: version
192+
run: |
193+
VERSION=$(grep 'jsoncmp.version=' gradle.properties | cut -d= -f2)
194+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
195+
196+
- name: Create GitHub Release
197+
env:
198+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
199+
run: |
200+
VERSION=${{ steps.version.outputs.version }}
201+
TAG="v${VERSION}"
202+
203+
if gh release view "$TAG" > /dev/null 2>&1; then
204+
echo "Release $TAG already exists, skipping."
205+
else
206+
gh release create "$TAG" \
207+
--title "$TAG" \
208+
--generate-notes \
209+
--target main
210+
fi

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# JsonCMP
2-
[![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)
2+
[![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)
33

44

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

1515
## Installation
1616

17+
Add the GitHub Packages repository to your `settings.gradle.kts`:
18+
19+
```kotlin
20+
// settings.gradle.kts
21+
dependencyResolutionManagement {
22+
repositories {
23+
maven {
24+
url = uri("https://maven.pkg.github.com/skymansandy/jsonCMP")
25+
credentials {
26+
username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_USERNAME")
27+
password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
28+
}
29+
}
30+
}
31+
}
32+
```
33+
34+
Then add the dependency:
35+
1736
```kotlin
1837
// build.gradle.kts
1938
dependencies {
20-
implementation("dev.skymansandy:json-cmp:<version>")
39+
implementation("dev.skymansandy:json-cmp:1.0.0-alpha2")
2140
}
2241
```
2342

docs/getting-started/installation.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,28 @@
11
# Installation
22

3+
## Repository Setup
4+
5+
JsonCMP is published to GitHub Packages. Add the repository to your `settings.gradle.kts`:
6+
7+
```kotlin
8+
// settings.gradle.kts
9+
dependencyResolutionManagement {
10+
repositories {
11+
maven {
12+
url = uri("https://maven.pkg.github.com/skymansandy/jsonCMP")
13+
credentials {
14+
username = providers.gradleProperty("gpr.user").orNull ?: System.getenv("GITHUB_USERNAME")
15+
password = providers.gradleProperty("gpr.key").orNull ?: System.getenv("GITHUB_TOKEN")
16+
}
17+
}
18+
}
19+
}
20+
```
21+
22+
> **Note:** GitHub Packages requires authentication. Add `gpr.user` and `gpr.key` to your
23+
> `~/.gradle/gradle.properties` or set `GITHUB_USERNAME` and `GITHUB_TOKEN` environment variables.
24+
> The token needs the `read:packages` scope.
25+
326
## Gradle (Kotlin DSL)
427

528
Add the dependency to your KMP module:
@@ -11,7 +34,7 @@ Add the dependency to your KMP module:
1134
kotlin {
1235
sourceSets {
1336
commonMain.dependencies {
14-
implementation("dev.skymansandy:json-cmp:<version>")
37+
implementation("dev.skymansandy:json-cmp:1.0.0-alpha2")
1538
}
1639
}
1740
}
@@ -22,7 +45,7 @@ Add the dependency to your KMP module:
2245
```kotlin
2346
// build.gradle.kts
2447
dependencies {
25-
implementation("dev.skymansandy:json-cmp:<version>")
48+
implementation("dev.skymansandy:json-cmp:1.0.0-alpha2")
2649
}
2750
```
2851

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ android.r8.strictFullModeForKeepRules=false
1717

1818
#Publishing
1919
jsoncmp.group=dev.skymansandy
20-
jsoncmp.version=1.0.0-alpha2
20+
jsoncmp.version=1.0.0-alpha1

0 commit comments

Comments
 (0)