Skip to content

Commit 3500848

Browse files
committed
Add release workflow and installation script for dPrompts
1 parent b367231 commit 3500848

File tree

2 files changed

+109
-0
lines changed

2 files changed

+109
-0
lines changed

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release dpr Binary
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
8+
jobs:
9+
build-and-release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Set up Go
16+
uses: actions/setup-go@v5
17+
with:
18+
go-version: '1.21'
19+
20+
- name: Build Linux amd64 binary
21+
run: |
22+
go build -o dpr .
23+
24+
- name: Upload Release Asset
25+
uses: softprops/action-gh-release@v2
26+
with:
27+
files: dpr
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

install.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
REPO_URL="https://github.com/HexmosTech/dPrompts"
6+
BINARY_URL="https://github.com/HexmosTech/dPrompts/releases/latest/download/dpr"
7+
BINARY_NAME="dpr"
8+
OLLAMA_MODEL="gemma2:2b"
9+
10+
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
11+
CONFIG_SRC="$SCRIPT_DIR/.dprompts.toml"
12+
13+
14+
REAL_HOME=$(getent passwd ${SUDO_USER:-$USER} | cut -d: -f6)
15+
CONFIG_DEST="$REAL_HOME/.dprompts.toml"
16+
17+
18+
echo "== dPrompts Installer =="
19+
20+
21+
echo "Downloading latest dPrompts binary..."
22+
curl -L "$BINARY_URL" -o "$BINARY_NAME"
23+
chmod +x "$BINARY_NAME"
24+
echo "Moving binary to /usr/local/bin/ (this may require your password)..."
25+
sudo mv "$BINARY_NAME" /usr/local/bin/
26+
27+
28+
if [ -f "$CONFIG_SRC" ]; then
29+
cp "$CONFIG_SRC" "$CONFIG_DEST"
30+
sudo chown $SUDO_USER:$SUDO_USER "$CONFIG_DEST" 2>/dev/null || true
31+
echo "Copied $CONFIG_SRC to $CONFIG_DEST"
32+
else
33+
echo "WARNING: $CONFIG_SRC not found. Please create your config and place it at $CONFIG_DEST"
34+
fi
35+
36+
37+
if ! command -v ollama &> /dev/null; then
38+
echo "Ollama is not installed."
39+
read -p "Do you want to install Ollama? (y/n): " yn
40+
if [[ "$yn" =~ ^[Yy]$ ]]; then
41+
curl -fsSL https://ollama.com/install.sh | sh
42+
else
43+
echo "Please install Ollama manually and re-run this script."
44+
exit 1
45+
fi
46+
else
47+
echo "Ollama is already installed."
48+
fi
49+
50+
51+
if ! pgrep -x "ollama" > /dev/null; then
52+
echo "Ollama server is not running. Starting Ollama server in the background..."
53+
nohup ollama serve > /dev/null 2>&1 &
54+
sleep 2
55+
if pgrep -x "ollama" > /dev/null; then
56+
echo "Ollama server started."
57+
else
58+
echo "Failed to start Ollama server. Please start it manually."
59+
exit 1
60+
fi
61+
else
62+
echo "Ollama server is already running."
63+
fi
64+
65+
66+
if ! ollama list | grep -q "$OLLAMA_MODEL"; then
67+
echo "Ollama model '$OLLAMA_MODEL' is not present."
68+
read -p "Do you want to pull the model '$OLLAMA_MODEL'? (y/n): " yn
69+
if [[ "$yn" =~ ^[Yy]$ ]]; then
70+
ollama pull "$OLLAMA_MODEL"
71+
else
72+
echo "Please pull the model manually and re-run this script."
73+
exit 1
74+
fi
75+
else
76+
echo "Ollama model '$OLLAMA_MODEL' is already present."
77+
fi
78+
79+
echo "== Installation complete! =="
80+
echo "You can now use the 'dpr --mode=worker' command to start the dPrompts worker."

0 commit comments

Comments
 (0)