Skip to content

Commit

Permalink
branch aware deploy-server
Browse files Browse the repository at this point in the history
  • Loading branch information
rootTHC committed Dec 2, 2024
1 parent 9e6c02f commit fcde004
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/deploy-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
run: |
cp deploy/deploy.sh /tmp/y
cp deploy/deploy_server.sh /tmp/ys
sed "s|^CICD_GS_BRANCH=.*|CICD_GS_BRANCH=\"${DSTDIR:1}\"|" -i "y"
sed "s|^CICD_GS_BRANCH=.*|CICD_GS_BRANCH=\"${DSTDIR:1}\"|" -i "ys"
- name: Clone https://gsocket.io
env:
Expand Down
11 changes: 9 additions & 2 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,11 @@
# - Guess what...

# Global Defines
### DISABLE ME:
[[ -z $GS_BRANCH ]] && GS_BRANCH="beta"
###----BEGIN changed by CICD script-----
CICD_GS_BRANCH=
###-----END-----
[[ $CICD_GS_BRANCH == "master" ]] && unset CICD_GS_BRANCH
[[ -z $GS_BRANCH ]] && GS_BRANCH="${CICD_GS_BRANCH}"

URL_BASE_CDN="https://cdn.gsocket.io"
URL_BASE_X="https://gsocket.io"
Expand All @@ -90,8 +93,12 @@ URL_BASE_X="https://gsocket.io"
# These stubs are filled out by deploy_server.sh:
IS_DEPLOY_SERVER=
URL_BASE=
DS_GS_HOST=
DS_GS_PORT=
[[ -n $URL_BASE ]] && [[ -z $GS_URL_BASE ]] && GS_URL_BASE="$URL_BASE"
[[ -n $IS_DEPLOY_SERVER ]] && unset GS_BRANCH
[ -z "$GS_HOST" ] && GS_HOST="$DS_GS_HOST"
[ -z "$GS_PORT" ] && GS_PORT="$DS_GS_PORT"
gs_deploy_webhook=
GS_WEBHOOK_404_OK=
[[ -n $gs_deploy_webhook ]] && GS_WEBHOOK="$gs_deploy_webhook"
Expand Down
16 changes: 10 additions & 6 deletions deploy/deploy_server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@
# LOG=results.log bash -c "$(curl -fsSL https://gsocket.io/deploy/ys)"

[[ -z $PORT ]] && PORT="32803"
[[ -z $GS_BRANCH ]] && GS_BRANCH="master"
BINDIR="${GS_BRANCH}/bin"
[[ $GS_BRANCH == master ]] && BINDIR="bin"

###----BEGIN changed by CICD script-----
CICD_GS_BRANCH=
###-----END-----
[[ $CICD_GS_BRANCH == "master" ]] && unset CICD_GS_BRANCH
[[ -z $GS_BRANCH ]] && GS_BRANCH="${CICD_GS_BRANCH}"
BINDIR="${GS_BRANCH:+$GS_BRANCH/}bin"

DEPLOY_SH_NAME="y"

Expand Down Expand Up @@ -173,14 +177,14 @@ sed "s|^URL_BASE=.*|URL_BASE=\"${URL_BASE}\"|" -i "${DATA_DIR}/${DEPLOY_SH_NAME}
sed "s|^IS_DEPLOY_SERVER=.*|IS_DEPLOY_SERVER=1|" -i "${DATA_DIR}/${DEPLOY_SH_NAME}"
sed "s|^gs_deploy_webhook=.*|gs_deploy_webhook='${URL_BASE}/results.php?s=\${GS_SECRET}'|" -i "${DATA_DIR}/${DEPLOY_SH_NAME}"
sed 's|^GS_WEBHOOK_404_OK=.*|GS_WEBHOOK_404_OK=1|' -i "${DATA_DIR}/${DEPLOY_SH_NAME}"
[ -n "$GS_HOST" ] && sed 's|^DS_GS_HOST=.*|DS_GS_HOST='"'$GS_HOST'"'|' -i "${DATA_DIR}/${DEPLOY_SH_NAME}"
[ -n "$GS_PORT" ] && sed 's|^DS_GS_PORT=.*|DS_GS_PORT='"'$GS_PORT'"'|' -i "${DATA_DIR}/${DEPLOY_SH_NAME}"

echo -e "\
${CDG}All successfull deployments will be shown below.${CN}
${CDG}All successful deployments will be shown below.${CN}
${CDY}To log via Telegram, Discord or webhook.site please edit
${CW}$(realpath "$(pwd)/${DATA_DIR}/y")${CDY} and set${CN}
1. ${CDC}GS_TG_TOKEN=${CN}, ${CDC}GS_TG_CHATID=${CN} OR ${CDC}GS_DISCORD_KEY=${CN} OR ${CDC}GS_WEBHOOK_KEY=${CN}
${CW}${CF}Set the IP/HOST and PORT if you run your OWN Relay Network:
${CF}2. ${CC}${CF}GS_HOST=1.2.3.4${CN}, ${CC}${CF}GS_PORT=443${CN}
To deploy gsocket:
${CM}bash -c \"\$(curl -fsSL ${URL_BASE}/y)\"${CN}
${CM}bash -c \"\$(wget --no-verbose -O- ${URL_BASE}/y)\"${CN}
Expand Down

0 comments on commit fcde004

Please sign in to comment.