Skip to content

Commit a298645

Browse files
committed
update zudoku docs from repo archive
1 parent edb43f1 commit a298645

File tree

1 file changed

+37
-22
lines changed

1 file changed

+37
-22
lines changed

scripts/get-zudoku.sh

+37-22
Original file line numberDiff line numberDiff line change
@@ -4,51 +4,66 @@
44
set -e
55

66
# Variables
7-
ASSET_URL="https://cdn.zudoku.dev/release/docs.zip"
7+
ASSET_URL="https://github.com/zuplo/zudoku/archive/refs/heads/main.tar.gz"
88
DOWNLOAD_DIR="/tmp/zudoku_download"
99
DEST_DIR="docs/dev-portal/zudoku"
1010

11+
# Function to log messages
12+
log() {
13+
echo "[INFO] $1"
14+
}
15+
1116
# Remove existing directories
12-
rm -rf "$DOWNLOAD_DIR"
13-
rm -rf "$DEST_DIR"
17+
log "Removing existing directories..."
18+
rm -rf "$DOWNLOAD_DIR" "$DEST_DIR"
1419

1520
# Create download directory
21+
log "Creating download directory..."
1622
mkdir -p "$DOWNLOAD_DIR"
1723

18-
# Download the latest zip release
19-
ZIP_FILE="$DOWNLOAD_DIR/zudoku_docs.zip"
20-
echo "Downloading the latest release..."
21-
curl -L -o "$ZIP_FILE" "$ASSET_URL"
24+
# Download the latest tar.gz release
25+
TAR_FILE="$DOWNLOAD_DIR/zudoku_docs.tar.gz"
26+
log "Downloading the latest release..."
27+
curl -L -o "$TAR_FILE" "$ASSET_URL"
2228

23-
# Extract the zip file
24-
echo "Extracting the contents..."
25-
unzip -q "$ZIP_FILE" -d "$DOWNLOAD_DIR/extracted"
29+
# Extract the tar.gz file
30+
log "Extracting the contents..."
31+
mkdir -p "$DOWNLOAD_DIR/extracted"
32+
tar -xzf "$TAR_FILE" -C "$DOWNLOAD_DIR/extracted"
2633

2734
# Find the docs folder in the extracted contents
2835
EXTRACTED_DIR=$(find "$DOWNLOAD_DIR/extracted" -mindepth 1 -maxdepth 1 -type d | head -n 1)
2936

30-
echo $EXTRACTED_DIR
37+
if [ -z "$EXTRACTED_DIR" ]; then
38+
log "Error: Unable to find extracted directory."
39+
exit 1
40+
fi
41+
42+
log "Extracted directory: $EXTRACTED_DIR"
3143

32-
if [ -d "$EXTRACTED_DIR/pages" ]; then
33-
echo "Copying 'pages' folder to $DEST_DIR..."
44+
if [ -d "$EXTRACTED_DIR/docs/pages" ]; then
45+
log "Copying 'pages' folder to $DEST_DIR..."
3446
mkdir -p "$DEST_DIR"
35-
cp -r "$EXTRACTED_DIR/pages"/* "$DEST_DIR"
47+
cp -r "$EXTRACTED_DIR/docs/pages/"* "$DEST_DIR"
3648
else
37-
echo "'pages' folder not found in the extracted contents."
49+
log "Error: 'pages' folder not found in the extracted contents."
3850
exit 1
3951
fi
4052

4153
# Clean up
42-
echo "Cleaning up..."
54+
log "Cleaning up temporary files..."
4355
rm -rf "$DOWNLOAD_DIR"
4456

45-
# Delete Docs we dont want
57+
# Delete unwanted docs
58+
log "Deleting unwanted docs..."
4659
rm -rf "$DEST_DIR/deploy"
47-
rm -rf "$DEST_DIR/deployment.md"
48-
rm -rf "$DEST_DIR/introduction.md"
49-
rm -rf "$DEST_DIR/app-quickstart.md"
50-
rm -rf "$DEST_DIR/html-quickstart.md"
60+
rm -f "$DEST_DIR/deployment.md"
61+
rm -f "$DEST_DIR/introduction.md"
62+
rm -f "$DEST_DIR/app-quickstart.md"
63+
rm -f "$DEST_DIR/html-quickstart.md"
5164

65+
# Run the update script
66+
log "Running the update script..."
5267
npx tsx ./scripts/update-zudoku-docs.mts
5368

54-
echo "Update complete! The 'docs' folder has been updated."
69+
log "Update complete! The 'docs' folder has been updated."

0 commit comments

Comments
 (0)