-
Notifications
You must be signed in to change notification settings - Fork 0
/
deploy-dev.sh
executable file
·26 lines (22 loc) · 848 Bytes
/
deploy-dev.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
#!/bin/sh
set -x
TMP_FILENAME=/tmp/yourfilehere
cat << EOF > $TMP_FILENAME
image:
tag: ${IMAGE_TAG}
EOF
ENCODED_CONTENTS="$(base64 $TMP_FILENAME | tr -d \\n)"
#ENCODED_CONTENTS=$(printf '%s' $(cat $TMP_FILENAME) | base64 -)
OAUTH_TOKEN="${GITHUB_PAT}"
SHA=$(curl -vvvvL \
-X GET \
-H "Authorization: token $OAUTH_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/rode/demo-app-deployment/contents/env-values.yaml?ref=dev | jq .sha | sed 's/"//g')
echo "sha: $SHA"
curl -vvvvL \
-X PUT \
-H "Authorization: token $OAUTH_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/rode/demo-app-deployment/contents/env-values.yaml \
-d "{\"message\":\"Deployment to Dev from CI - ${GIT_COMMIT}\",\"branch\":\"dev\",\"sha\":\"$SHA\",\"content\":\"$ENCODED_CONTENTS\"}"