Skip to content

Auto upload deploy.sh to gsocket.io/y #27

Auto upload deploy.sh to gsocket.io/y

Auto upload deploy.sh to gsocket.io/y #27

Workflow file for this run

name: Auto upload deploy.sh to gsocket.io/y
on:
push:
branches:
- master
- beta
paths:
- deploy/deploy.sh
- deploy/deploy_server.sh
workflow_dispatch:
env:
DSTDIR: ${{ github.ref == 'refs/heads/master' && '/' || '/beta' }}
jobs:
build:
name: Deploy to WWW
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Deploy.sh https://gsocket.io
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
run: |
cp deploy/deploy.sh /tmp/y
cp deploy/deploy_server.sh /tmp/ys
mkdir ~/.ssh && echo "$SSH_DEPLOY_KEY" >~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
cd /tmp/
git clone -b gh-pages --single-branch [email protected]:hackerschoice/gsocket.io.git
cd gsocket.io${DSTDIR:?}
pwd
cmp -s /tmp/y y || { cat /tmp/y >y; is_updated=1; }
cmp -s /tmp/ys ys || { cat /tmp/ys >ys; is_updated=1; }
[ -n $is_updated ] && {
git config --local user.name "GitHub Action"
git config --local user.email "[email protected]"
git add y && git commit -m "deploy y" && git push
}