Skip to content

Commit

Permalink
Add publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
alexstyl committed Aug 17, 2024
1 parent 8229868 commit f3e9773
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 2 deletions.
2 changes: 1 addition & 1 deletion RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ error: `No staging repository with name sonatype created`
./gradlew publishAllPublicationsToSonatypeRepository closeAndReleaseSonatypeStagingRepository
```

As soon as the version is available it will be listed at: https://repo1.maven.org/maven2/com/composables/core/
As soon as the version is available it will be listed at: https://repo1.maven.org/maven2/com/composables/icons-lucide/

## Release to Maven Local

Expand Down
2 changes: 1 addition & 1 deletion icons-lucide/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ plugins {

val publishGroupId = "com.composables"
val publishArtifactId = "icons-lucide"
val publishVersion = "0.0.1"
val publishVersion = "1.0.0"
val githubUrl = "github.com/composablehorizons/composeicons"

java {
Expand Down
48 changes: 48 additions & 0 deletions scripts/release_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

# Define the root directory as the current directory
root_dir=$(pwd)

# Read the docs version from the keyboard
previous_version=$(grep '^val publishVersion =' "$root_dir/icons-lucide/build.gradle.kts" | sed 's/^val publishVersion = "\([^\"]*\)"/\1/')

read -p "🚢 Shipping version $previous_version (y/n):" confirm
if [[ "$confirm" != "y" ]]; then
echo "Aborted."
exit 1
fi

# Read the WIP version from the keyboard
read -p "Enter next version (e.g., 1.8.0): " wip_version

echo "Publishing to Sonar..."

./gradlew publishAllPublicationsToSonatypeRepository closeAndReleaseSonatypeStagingRepository

echo "👍 Published $previous_version"

# Retrieve the last commit hash
last_commit=$(git rev-parse HEAD)

# Tag the last commit with the last version
git tag "$previous_version" $last_commit


# Find and update the version in .md files
find "$root_dir" -type f -name "*.md" -exec sed -i '' "s/implementation(\"com\.composables:core:[^\"]*\")/implementation(\"com.composables:core:$previous_version\")/g" {} +

# Update the publishVersion value in build.gradle.kts
sed -i '' "s/^val publishVersion = \".*\"/val publishVersion = \"$wip_version\"/" "$root_dir/core/build.gradle.kts"

# Add all changes to git
git add .

# Commit with the provided version in the message
git commit -m "Prepare version $wip_version"

git push origin --follow-tags

echo "💯 All done. Working version is $previous_version"

echo "TODO: Open a Github version for $previous_version"
open https://github.com/composablehorizons/composables-core/releases/new

0 comments on commit f3e9773

Please sign in to comment.