-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.sh
executable file
·41 lines (29 loc) · 1.06 KB
/
main.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
#!/usr/bin/env bash
BUILD_ID=$1
ACCESS_TOKEN=$2
BUILD_INFO=$(node ~/build_info.js $BUILD_ID $ACCESS_TOKEN)
# Get the values from the JSON and trim the qoute (") signs.
OWNER=$(echo $BUILD_INFO | jq '.owner' | cut -d '"' -f 2)
REPO=$(echo $BUILD_INFO | jq '.repo' | cut -d '"' -f 2)
BRANCH=$(echo $BUILD_INFO | jq '.branch' | cut -d '"' -f 2)
PRIVATE_KEY=$(echo $BUILD_INFO | jq '.private_key' | cut -d '"' -f 2)
GITHUB_ACCESS_TOKEN=$(echo $BUILD_INFO | jq '.github_access_token' | cut -d '"' -f 2)
# Get .shoov.json
curl -o ~/.shoov.json $BACKEND_URL/api/v1.0/config?access_token=$ACCESS_TOKEN
echo "Backend URL set to $BACKEND_URL"
# Get GitHub access token
cd ~/build
# Clone repo
echo "Starting clone of $OWNER/$REPO"
git clone --branch=$BRANCH --depth=1 --quiet https://[email protected]/$OWNER/$REPO.git .
echo "Clone done"
# Export variables.
touch ~/build/export.sh
node ~/export-vars.js $PRIVATE_KEY
source ~/build/export.sh
# Parse .shoov.yml file
node ~/parse.js
# Show commands from now on
set -x
# Execute the parsed .shoov.yml file
sh -c ~/shoov.sh