Skip to content

Commit 3ea613a

Browse files
committed
Change workflow name to Build & Release, and update install.sh to download precompiled ZIP from GitHub Releases with source fallback
1 parent cafd5b2 commit 3ea613a

2 files changed

Lines changed: 35 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI Build & Test
1+
name: Build & Release
22

33
on:
44
push:

install.sh

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,44 @@
11
#!/bin/bash
22
set -e
33

4+
VERSION="1.0.0"
5+
INSTALL_DIR="$HOME/.library-insight"
6+
ZIP_NAME="library-insight-cli-$VERSION.zip"
7+
RELEASE_URL="https://github.com/Coding-Meet/Library-Insight/releases/download/v$VERSION/$ZIP_NAME"
8+
49
echo "=================================================="
5-
echo " Building Library Insight CLI Distribution..."
10+
echo " Installing Library Insight v$VERSION..."
611
echo "=================================================="
7-
./gradlew :library-insight-cli:installDist
812

9-
INSTALL_DIR="$HOME/.library-insight"
10-
echo "Installing binaries into $INSTALL_DIR..."
13+
# Create install directory
1114
mkdir -p "$INSTALL_DIR"
12-
cp -R library-insight-cli/build/install/library-insight/* "$INSTALL_DIR/"
15+
16+
# Temporary download path
17+
TEMP_ZIP="/tmp/$ZIP_NAME"
18+
19+
echo "Attempting to download pre-compiled release from GitHub..."
20+
echo "URL: $RELEASE_URL"
21+
22+
# Download using curl
23+
if curl -L --fail -o "$TEMP_ZIP" "$RELEASE_URL"; then
24+
echo "Download successful! Extracting..."
25+
unzip -o "$TEMP_ZIP" -d "$INSTALL_DIR/"
26+
27+
# Check if files were extracted into a subdirectory and move them up
28+
if [ -d "$INSTALL_DIR/library-insight-cli-$VERSION" ]; then
29+
cp -R "$INSTALL_DIR/library-insight-cli-$VERSION"/* "$INSTALL_DIR/"
30+
rm -rf "$INSTALL_DIR/library-insight-cli-$VERSION"
31+
fi
32+
rm -f "$TEMP_ZIP"
33+
echo "Pre-compiled release installed successfully!"
34+
else
35+
echo "--------------------------------------------------"
36+
echo " Note: Release download failed (e.g. tag not pushed yet)."
37+
echo " Falling back to compiling from local source code..."
38+
echo "--------------------------------------------------"
39+
./gradlew :library-insight-cli:installDist
40+
cp -R library-insight-cli/build/install/library-insight/* "$INSTALL_DIR/"
41+
fi
1342

1443
echo "Configuring executable permissions..."
1544
chmod +x "$INSTALL_DIR/bin/library-insight"

0 commit comments

Comments
 (0)