Skip to content

Commit 978a2c8

Browse files
committed
Add nanpa configuration
Use custom script to replace version in Podspec, README, and LiveKitSDK class
1 parent e823f75 commit 978a2c8

File tree

3 files changed

+48
-0
lines changed

3 files changed

+48
-0
lines changed

.nanpa/.keep

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Add changeset files in this directory.
2+
3+
See nanpa documentation for more info:
4+
https://github.com/nbsp/nanpa/blob/trunk/doc/nanpa-changeset.5.scd

.nanparc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
version 2.1.0
2+
name LiveKit
3+
custom ./scripts/replace_version.sh

scripts/replace_version.sh

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/sh
2+
# This script is invoked by nanpa with the new version set in VERSION.
3+
# ed is used instead of sed to make this script POSIX compliant (run on Mac or Linux runner).
4+
5+
if [ -z "${VERSION}" ]; then
6+
echo "Error: VERSION is not set. Exiting..."
7+
exit 1
8+
fi
9+
10+
replace() {
11+
ed -s "$1" >/dev/null
12+
if [ $? -ne 0 ]; then
13+
echo "Error: unable to replace version in $1" >&2
14+
exit 1
15+
fi
16+
}
17+
18+
# 1. Podspec version & tag
19+
# -----------------------------------------
20+
replace ./LiveKitClient.podspec <<EOF
21+
,s/spec.version = "[^"]*"/spec.version = "${VERSION}"/g
22+
,s/:tag => "[^"]*"/:tag => "${VERSION}"/g
23+
w
24+
q
25+
EOF
26+
27+
# 2. README.md, installation guide
28+
# -----------------------------------------
29+
replace ./README.md <<EOF
30+
,s/upToNextMajor("[^"]*")/upToNextMajor("${VERSION}")/g
31+
w
32+
q
33+
EOF
34+
35+
# 3. LiveKitSDK class, static version constant
36+
# -----------------------------------------
37+
replace ./Sources/LiveKit/LiveKit.swift <<EOF
38+
,s/static let version = "[^"]*"/static let version = "${VERSION}"/g
39+
w
40+
q
41+
EOF

0 commit comments

Comments
 (0)