FFPID internal #70
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
# Should be executed after deploy.sh has changed or after | |
# stealth binaries have been build. | |
name: Auto upload deploy.sh to gsocket.io/y | |
# on: [workflow_dispatch] | |
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: Copying deploy.sh | |
run: | | |
cp deploy/deploy.sh /tmp/y | |
cp deploy/deploy_server.sh /tmp/ys | |
- name: Clone https://gsocket.io | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} | |
run: | | |
mkdir ~/.ssh && echo "$SSH_DEPLOY_KEY" >~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519 | |
cd /tmp/ | |
git clone -b gh-pages --depth 1 --single-branch [email protected]:hackerschoice/gsocket.io.git | |
- name: Building deploy-all.sh | |
run: | | |
cmp -s /tmp/y "/tmp/gsocket.io${DSTDIR:?}/y" || { | |
cp "${GITHUB_WORKSPACE:?}/deploy/deploy.sh" "/tmp/gsocket.io${DSTDIR}/bin/deploy.sh" | |
"${GITHUB_WORKSPACE:?}/packaging/deploy-all/build.sh" /tmp/deploy-all.sh "/tmp/gsocket.io${DSTDIR:?}/bin" | |
rm -f "gsocket.io${DSTDIR}/bin/deploy.sh" | |
} | |
- name: Uploading to https://gsocket.io | |
env: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} | |
run: | | |
cd "/tmp/gsocket.io${DSTDIR:?}" | |
pwd | |
[ -f /tmp/deploy-all.sh ] && ls -al /tmp/deploy-all.sh | |
[ -f bin/deploy-all.sh ] && ls -al bin/deploy-all.sh | |
if [ -f /tmp/deploy-all.sh ]; then | |
cmp -s /tmp/deploy-all.sh bin/deploy-all.sh || { cat /tmp/deploy-all.sh >bin/deploy-all.sh; is_updated=1; } | |
fi | |
cmp -s /tmp/y y || { cat /tmp/y >x; cat /tmp/y >y; is_updated=1; } | |
cmp -s /tmp/ys ys || { cat /tmp/ys >xs; 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 bin/deploy-all.sh x xs y ys && git commit -m "deploy y & ys" && git push | |
} | |