Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit 312474d

Browse files
committed
feat: auto-update version in README and openiap-versions.json on publish
- Add update-version.sh script to update versions in README and openiap-versions.json - Update publish.yml workflow to auto-update versions after publishing - Update current version to 1.2.7 in README
1 parent 7ea1f0b commit 312474d

File tree

4 files changed

+72
-3
lines changed

4 files changed

+72
-3
lines changed

.github/workflows/publish.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,17 @@ jobs:
9696
tag_name: ${{ env.VERSION }}
9797
env:
9898
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
99+
100+
- name: Update version in README and openiap-versions.json
101+
run: |
102+
# Use the update script
103+
chmod +x ./scripts/update-version.sh
104+
./scripts/update-version.sh "$VERSION"
105+
106+
- name: Commit and push version updates
107+
run: |
108+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
109+
git config --local user.name "github-actions[bot]"
110+
git add README.md openiap-versions.json
111+
git diff --staged --quiet || git commit -m "chore: update version to $VERSION [skip ci]"
112+
git push origin HEAD:main

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,15 @@ Add to your module's `build.gradle.kts`:
4848

4949
```kotlin
5050
dependencies {
51-
implementation("io.github.hyochan.openiap:openiap-google:1.2.6")
51+
implementation("io.github.hyochan.openiap:openiap-google:1.2.7")
5252
}
5353
```
5454

5555
Or `build.gradle`:
5656

5757
```groovy
5858
dependencies {
59-
implementation 'io.github.hyochan.openiap:openiap-google:1.2.6'
59+
implementation 'io.github.hyochan.openiap:openiap-google:1.2.7'
6060
}
6161
```
6262

openiap-versions.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"google": "1.2.7",
33
"gql": "1.0.9"
4-
}
4+
}

scripts/update-version.sh

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
# This script updates the version in README.md and openiap-versions.json
5+
# Usage: ./scripts/update-version.sh <version>
6+
7+
if [ $# -ne 1 ]; then
8+
echo "Usage: $0 <version>"
9+
echo "Example: $0 1.2.7"
10+
exit 1
11+
fi
12+
13+
VERSION="$1"
14+
# Trim leading 'v' if present
15+
VERSION="${VERSION#v}"
16+
17+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
18+
REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
19+
README_FILE="${REPO_ROOT}/README.md"
20+
VERSIONS_FILE="${REPO_ROOT}/openiap-versions.json"
21+
22+
echo "Updating version to $VERSION"
23+
24+
# Update README.md
25+
if [[ "$OSTYPE" == "darwin"* ]]; then
26+
# macOS uses different sed syntax
27+
sed -i '' "s/openiap-google:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/openiap-google:$VERSION/g" "$README_FILE"
28+
else
29+
# Linux
30+
sed -i "s/openiap-google:[0-9]\+\.[0-9]\+\.[0-9]\+/openiap-google:$VERSION/g" "$README_FILE"
31+
fi
32+
33+
# Update openiap-versions.json (preserving gql version)
34+
if command -v python3 &> /dev/null; then
35+
GQL_VERSION=$(python3 -c "import json; print(json.load(open('$VERSIONS_FILE'))['gql'])" 2>/dev/null || echo "1.0.9")
36+
else
37+
GQL_VERSION=$(grep '"gql"' "$VERSIONS_FILE" | sed 's/.*"gql".*"\([^"]*\)".*/\1/')
38+
fi
39+
40+
cat > "$VERSIONS_FILE" << EOF
41+
{
42+
"google": "$VERSION",
43+
"gql": "$GQL_VERSION"
44+
}
45+
EOF
46+
47+
echo "✅ Updated README.md and openiap-versions.json to version $VERSION"
48+
echo ""
49+
echo "Files modified:"
50+
echo " - $README_FILE"
51+
echo " - $VERSIONS_FILE"
52+
echo ""
53+
echo "To commit these changes:"
54+
echo " git add README.md openiap-versions.json"
55+
echo " git commit -m \"chore: update version to $VERSION\""

0 commit comments

Comments
 (0)