Skip to content

Commit 11d2adb

Browse files
committed
ci: add scripts
1 parent 870eb02 commit 11d2adb

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

get_changelog.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/bash
2+
3+
# Accept the version as a command-line argument
4+
version=$1
5+
6+
# Find the line number where the version is mentioned
7+
start=$(grep -n "\[$version\]" CHANGELOG.md | cut -d : -f 1)
8+
9+
# If the version is not found, use "Unreleased"
10+
if [ -z "$start" ]; then
11+
version="Unreleased"
12+
start=$(grep -n "\[$version\]" CHANGELOG.md | cut -d : -f 1)
13+
fi
14+
15+
# Increment the start line to skip the version line
16+
start=$((start + 1))
17+
18+
# Find the line number of the next version
19+
end=$(awk -v start=$start 'NR > start && /\[.*\]/ {print NR; exit}' CHANGELOG.md)
20+
21+
# If the next version is not found, print until the end of the file
22+
if [ -z "$end" ]; then
23+
awk -v start=$start 'NR >= start' CHANGELOG.md
24+
else
25+
awk -v start=$start -v end=$end 'NR >= start && NR < end' CHANGELOG.md
26+
fi

publish_snapshot.sh

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Check if the file exists
2+
MAVEN_CENTRAL_USERNAME=$1
3+
MAVEN_CENTRAL_PASSWORD=$2
4+
if [ ! -f "gradle.properties" ]; then
5+
echo "gradle.properties does not exist."
6+
exit 1
7+
fi
8+
# Append -SNAPSHOT to the VERSION_NAME
9+
sed -i -e '/VERSION_NAME/s/$/-SNAPSHOT/' "gradle.properties"
10+
11+
./gradlew publishAllPublicationsToMavenCentralRepository \
12+
-PmavenCentralUsername="$MAVEN_CENTRAL_USERNAME" \
13+
-PmavenCentralPassword="$MAVEN_CENTRAL_PASSWORD"

0 commit comments

Comments
 (0)