-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.sh
executable file
·44 lines (32 loc) · 1.24 KB
/
build.sh
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
#!/bin/bash
# Set variables
REPO="tonyalaribe/quickstatic"
BINARY_NAME="quickstatic"
# GitHub API URL for the latest release
API_URL="https://api.github.com/repos/$REPO/releases/latest"
# Use curl to fetch the latest release data in JSON format
# Use grep to find the line containing the tag_name, then cut to extract the value
TAG_NAME=$(curl -s $API_URL | grep '"tag_name":' | sed -E 's/.*"tag_name": "([^"]+)".*/\1/')
# Construct the asset name based on the provided format
# Assuming the architecture is x86_64-unknown-linux-musl, adjust if necessary
ASSET_NAME="quickstatic_${TAG_NAME}_x86_64-unknown-linux-musl.tar.gz"
# Construct the download URL for the asset
DOWNLOAD_URL="https://github.com/$REPO/releases/download/$TAG_NAME/$ASSET_NAME"
# Download the asset
echo "Downloading $ASSET_NAME FROM $DOWNLOAD_URL ..."
curl -L $DOWNLOAD_URL -o $ASSET_NAME
# Check if the download was successful
if [ -f "$ASSET_NAME" ]; then
# Extract the downloaded tar.gz file
echo "Extracting $ASSET_NAME..."
tar -xvf $ASSET_NAME
echo "$ASSET_NAME extracted."
else
echo "Failed to download $ASSET_NAME."
fi
# Make the binary executable
chmod +x $BINARY_NAME
npm i
make css-prod
# Run the binary to generate the static site
./$BINARY_NAME build