forked from graphql/vscode-graphql
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publish.sh
39 lines (34 loc) · 1.04 KB
/
publish.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
#!/bin/bash
if [ -f ".envrc" ]; then
echo "Loading .envrc"
source .envrc
else
echo "No .envrc"
fi
echo "============================"
echo "PAT: $PAT"
echo "PRODUCTION: $PRODUCTION"
echo "============================"
if [ "$PRODUCTION" = "1" ]; then
git config --global user.email "[email protected]"
git config --global user.name "Prismo"
git remote add github "https://$GITHUB_ACTOR:[email protected]/$GITHUB_REPOSITORY.git" || true
else
echo "Not setting up repo because PRODUCTION is not set"
fi
if [ -z "$PAT" ]; then
echo "\$PAT is empty. Please set the value of $PAT"
elif [ -n "$PAT" ]; then
if [ "$PRODUCTION" = "1" ]; then
./node_modules/.bin/vsce publish patch --pat $PAT
else
echo "Printing the command because PRODUCTION is not set"
echo "./node_modules/.bin/vsce publish patch --pat $PAT"
fi
fi
if [ "$PRODUCTION" = "1" ]; then
git pull github "${GITHUB_REF}" --ff-only
git push github HEAD:"${GITHUB_REF}"
else
echo "Not pushing because PRODUCTION is not set"
fi