Skip to content

Commit dc3b495

Browse files
authored
created install script
1 parent ad514a8 commit dc3b495

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

install.sh

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/bin/sh
2+
set -euxo pipefail #exit in case of errors
3+
4+
# install dependencies
5+
sudo apt update && sudo apt upgrade -y && sudo apt install -y git && sudo apt install -y gh && sudo apt install -y curl && sudo apt install -y nodejs && sudo apt install -y npm
6+
echo
7+
#Configures git
8+
read -p $'\e[1mEnter Github username: \e[22m' username
9+
git config --global user.name $username
10+
echo -e "\xE2\x9C\x94 set git username to $username"
11+
12+
read -p $'\e[1mEnter Github email: \e[22m' email
13+
git config --global user.email $email
14+
echo -e "\xE2\x9C\x94 set git email to $email"
15+
echo
16+
17+
#Configures github CLI
18+
echo -e '\e[1m----------------Logging in to GitHub CLI:----------------\e[22m'
19+
gh auth login
20+
echo -e '\xE2\x9C\x94 \e[1m----------------Logged in to GitHub CLI:----------------\e[22m'
21+
echo
22+
23+
#fork and clone repositories
24+
gh repo fork --clone=true https://github.com/badging/badging-bot.git
25+
gh repo fork --clone=false https://github.com/badging/event-diversity-and-inclusion.git
26+
echo
27+
28+
#configure github app
29+
echo -e '\e[91mREAD CAREFULLY AND FOLLOW THE INSTRUCTIONS BELOW TO CONFIGURE YOUR LOCAL DEVELOPMENT ENVIRONMENT.\e[39m'
30+
echo -e '\e[38;5;42mNavigate to https://github.com/settings/apps/new to create a new personal badging-bot Github test app.
31+
This app will be installed on your test repository at https://github.com/$username/event-diversity-and-inclusion.
32+
Since the app may be used to test a lot of use cases, ensure that all the access permissions are set to \e[1mRead and Write\e[22m and or all checkboxes are marked.\e[39m'
33+
34+
echo -e '\e[91mEnsure that you supply a Webhook URL and Webhook Secret for your new app.\e[39m'
35+
echo -e '\e[38;5;42mFor the Webhook URL, visit https://smee.io, copy and paste the URL to the \eWebhook URL section of the app\e[22m and also to the prompt below.\e[39m'
36+
echo
37+
38+
#create temporary env file
39+
touch .env
40+
echo -e "\xE2\x9C\x94 created temporary .env file"
41+
echo
42+
43+
read -p $'\e[1mEnter Webhook URL: \e[22m' webhookurl
44+
echo "webhookURL=$webhookurl" >> .env
45+
echo -e "\xE2\x9C\x94 set webhookURL to $webhookurl"
46+
echo
47+
48+
read -p $'\e[1mEnter Webhook Secret: \e[22m' webhooksecret
49+
echo "webhookSecret=$webhooksecret" >> .env
50+
echo -e "\xE2\x9C\x94 set webhookSecret to $webhooksecret"
51+
echo
52+
53+
echo -e '\e[38;5;42mOnce the app is created, you will be redirected to another page that will help you access the following
54+
1. App Id
55+
2. Client Id
56+
3. Client Secret (this will be generated and pasted in the prompt below)
57+
4. Private key (You will be required to download a PEM file and provide the FULL PATH to it in the prompt below)\e[39m'
58+
echo
59+
60+
echo -e '\e[91mFill in the following information as set in your app settings\e[39m'
61+
read -p $'\e[1mEnter App Id: \e[22m' appid
62+
echo "appId=$appid" >> .env
63+
echo -e "\xE2\x9C\x94 set appId to $appid"
64+
echo
65+
66+
read -p $'\e[1mEnter Client Id: \e[22m' clientid
67+
echo "clientId=$clientid" >> .env
68+
echo -e "\xE2\x9C\x94 set clientId to $clientid"
69+
echo
70+
71+
read -p $'\e[1mEnter Client Secret: \e[22m' clientsecret
72+
echo "clientSecret=$clientsecret" >> .env
73+
echo -e "\xE2\x9C\x94 set clientSecret to $clientsecret"
74+
echo
75+
76+
read -p $'\e[1mEnter FULL PATH to downloaded PEM file: \e[22m' privatekeyPath
77+
echo "privateKey=$(cat $privatekeyPath)" >> .env
78+
echo -e "\xE2\x9C\x94 set privateKey"
79+
echo
80+
81+
echo "PORT=2020" >> .env
82+
echo -e "\xE2\x9C\x94 set PORT to 2020"
83+
echo
84+
85+
while true; do
86+
read -p $'\e[38;5;42mHave you installed the test app on your forked \e[1mevent-diversity-and-inclusion\e[22m repository? (y/n): \e[39m' answer
87+
88+
if [ $answer == y ];then
89+
break
90+
else
91+
echo -e '\e[38;5;42mFor guidance, visit https://docs.github.com/en/developers/apps/managing-github-apps/installing-github-apps \e[39m'
92+
echo
93+
fi
94+
done
95+
echo
96+
97+
cd badging-bot
98+
echo -e "\xE2\x9C\x94 moved to badging-bot directory"
99+
100+
mv ../.env . && rm -rf ../.env
101+
echo -e "\xE2\x9C\x94 moved .env file to badging-bot directory"
102+
103+
npm ci
104+
105+
npm run dev

0 commit comments

Comments
 (0)