This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto upload deploy.sh to gsocket.io/x | |
on: | |
push: | |
branches: | |
- master | |
- beta | |
paths: | |
- deploy/deploy.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/x | |
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/x x || { | |
cat /tmp/x >x | |
git config --local user.name "GitHub Action" | |
git config --local user.email "[email protected]" | |
git add x && git commit -m "deploy x" && git push | |
} | |