-
Notifications
You must be signed in to change notification settings - Fork 137
64 lines (57 loc) · 2.16 KB
/
deploy-push.yaml
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# 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 git@github.com: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 "root@proton.thc.org"
git add bin/deploy-all.sh x xs y ys && git commit -m "deploy y & ys" && git push
}