-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetenv
executable file
·40 lines (33 loc) · 1.4 KB
/
setenv
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
#!/bin/sh
set -x
# Set env vars
# Based on:
# https://github.com/Sifchain/sifchain-ui/blob/d4768847/.github/workflows/pinata-build-deploy-ui.yml
# https://github.com/Sifchain/sifchain-ui/blob/1e274c48/.github/workflows/vercel-deploy-ui.yml
# Get GITHUB_* from docker build-args since we aren't running this in github workflows :-)
GITHUB_REF=$BRANCH
GITHUB_SHA=$COMMIT
GITHUB_ENV=.githubenv
BRANCH_NAME=$(echo ${GITHUB_REF#refs/heads/})
TAG_NAME=$(git tag --points-at HEAD)
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
echo "VITE_APP_VERSION=$(cat ./ui/app/package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
echo "VITE_APP_SHA=$GITHUB_SHA" >> $GITHUB_ENV
if [[ "$BRANCH_NAME" == 'master' ]]
then
echo "SUBDOMAIN=staging" >> $GITHUB_ENV
echo "VITE_APP_DEPLOYMENT=production" >> $GITHUB_ENV
elif [[ "$TAG_NAME" != '' ]]
then
echo "SUBDOMAIN=testnet" >> $GITHUB_ENV
echo "VITE_APP_DEPLOYMENT=staging" >> $GITHUB_ENV
else
echo "SUBDOMAIN=devnet" >> $GITHUB_ENV
echo "VITE_APP_DEPLOYMENT=develop" >> $GITHUB_ENV
fi
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "VITE_APP_VERSION=$(cat ./ui/app/package.json | jq '.version' | tr -d '"')" >> $GITHUB_ENV
echo "VITE_APP_SHA=$GITHUB_SHA" >> $GITHUB_ENV
# https://github.com/Sifchain/sifchain-ui/blob/1e274c48/.github/workflows/vercel-deploy-ui.yml#L45
echo "VITE_APP_SHA=$GITHUB_SHA" >> ./ui/app/.env