File size: 1,680 Bytes
44aa1b9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cb772ce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44aa1b9
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash

set -e  # Exit on any error

echo "Starting release process..."

# Execute build script
echo "Running build script..."
./build.sh

# Check if build was successful
if [ $? -ne 0 ]; then
    echo "Error: Build failed, aborting release"
    exit 1
fi

echo "Build completed successfully, preparing git operations..."

# Add all new build artifacts
echo "Adding build artifacts to git..."
git add .output/
git add .env 2>/dev/null || echo "No .env file to add"
git add .env.example 2>/dev/null || echo "No .env.example file to add"

# Check if there are any changes to commit
if git diff --staged --quiet; then
    echo "No changes to commit, release process completed"
    exit 0
fi

# Get current timestamp for commit message
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')

# Commit changes
echo "Committing changes..."
git commit -m "chore: update build artifacts - $TIMESTAMP"

# Push changes
echo "Pushing changes to remote..."
git push

# Get git remote URL and generate HF Space short link
echo "Generating Hugging Face Space link..."
GIT_URL=$(git remote get-url origin)
echo "Git remote URL: $GIT_URL"

# Extract repo path from HF Space URL and generate short link
if [[ $GIT_URL == *"huggingface.co"* ]]; then
    # Extract the repo path (remove .git suffix if present)
    REPO_PATH=$(echo "$GIT_URL" | sed -E 's|.*huggingface\.co/spaces/([^/]+/[^/]+)(\.git)?.*|\1|')
    HF_SHORT_LINK="https://hf.co/spaces/$REPO_PATH"
    echo "🚀 Hugging Face Space: $HF_SHORT_LINK"
else
    echo "Note: This doesn't appear to be a Hugging Face Space repository"
fi

echo "Release completed successfully!"
echo "Build artifacts have been committed and pushed to remote repository"