-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpublish.sh
More file actions
executable file
·95 lines (72 loc) · 2.01 KB
/
publish.sh
File metadata and controls
executable file
·95 lines (72 loc) · 2.01 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/bin/zsh
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title cow publish
# @raycast.mode fullOutput
# Optional parameters:
# @raycast.icon 🎼
# @raycast.argument1 { "type": "text", "placeholder": "Episode Number" }
# @raycast.packageName cowsay-audio
# @raycast.needsConfirmation true
# Documentation:
# @raycast.description download audio from youtube
# @raycast.author vladd
# @raycast.authorURL https://raycast.com/vladd
. ./messages.sh
. ./logging.sh
. ./vars.sh
set -euo pipefail
# set -x
# set -m
print_message "Preparing to execute the script"
# Check for episode number to be present
if [ -z "$1" ]; then
print_error "This script needs episode number in order to work"
exit 1
fi
# Prepare the logs
prepare_logging "publish"
# Check on OS
OS="$(uname -s)"
if [ $OS != "Darwin" ]; then
print_error "This script is meant to be running on macOS"
exit 1
fi
# Check for certificates to be there
print_message "Add Github and Azure certificates"
cd ~/.ssh
ssh-add "$GITHUB_CERT_PATH" > "$LOG" 2>&1
ssh-add "$AZURE_CERT_PATH" > "$LOG" 2>&1
# Go to cowsay source
cd "$COWSAY_SOURCE"
cd ..
# Run server and open the page to check
print_message "Launching the server... openning the page"
bundle exec octopod s > "$LOG" 2>&1 &
PID=$!
until grep -q "Server address: "$LOCAL_ADDRESS"" "$LOG"; do
sleep 1
done
open "$LOCAL_ADDRESS"
sleep 1
kill $PID
# Ask user to deploy this variant
print_message "Do you want to proceed with this variant? y/[n]"
read ANSWER
if [ -z "$ANSWER" ]; then
print_error "Not using this variant, please run the script again"
exit 0
elif [ "$ANSWER" = "y" ]; then
bundle exec octopod b > "$LOG" 2>&1
bundle exec octopod deploy > "$LOG" 2>&1
else
print_error "Not using this variant, please run the script again"
exit 0
fi
print_success "Site is successfully deployed 🐮"
open "$PUBLIC_ADDRESS"
# Update repo
git add . > "$LOG" 2>&1
git commit -m "Episode $1" > "$LOG" 2>&1
git push > "$LOG" 2>&1
print_success "The new episode is pushed to Github 🐮"