-
-
Notifications
You must be signed in to change notification settings - Fork 7
55 lines (47 loc) · 2.04 KB
/
staging.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
name: Deploy to Staging on Successful Build
on:
workflow_run:
workflows: ["Build Svelte using Bun"]
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Exit if the branch is not master
run: |
if [[ "${{ github.ref }}" != "refs/heads/main" ]]; then
echo "Branch is not master, exiting."
exit 0
fi
- name: Setup Cloudflared
run: |
curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb
sudo dpkg -i cloudflared.deb
shell: bash
- name: Setup ssh cloudflared config
run: |
mkdir -p ~/.ssh
printf "Host sshstaging.lolpro11.me\nProxyCommand /usr/bin/cloudflared access ssh --hostname %%h" > ~/.ssh/config
echo "${{ secrets.STAGING_SERVER }}" > ~/.ssh/known_hosts
shell: bash
- name: Setup SSH Key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
shell: bash
- name: SSH
run: |
ssh [email protected] \
"echo '${{ secrets.SUDO_PASSWD }}' | sudo -S bash -c 'chown -R lolpro11 /opt/catenary-frontend'; \
echo '${{ secrets.SUDO_PASSWD }}' | sudo -S -u lolpro11 bash -c \
'source /home/lolpro11/.profile ; \
cd /opt/catenary-frontend; \
git restore .; \
echo -e \"const martinpool = [\\n\\t \\\"https://martinstaging.lolpro11.me\\\",\\n];\\n\\nconst kactuspool = [\\n\\t \\\"https://kactusstaging.lolpro11.me\\\",\\n];\\n\\nconst backendpool = [\\n\\t\\\"https://backendstaging.lolpro11.me\\\",\\n]\\n\$(tail -n +15 src/components/distributed.ts)\" > src/components/distributed.ts; \
git pull -X theirs; \
bun install; \
bun run build'; \
echo '${{ secrets.SUDO_PASSWD }}' | sudo -S systemctl restart transitfrontend.service"
shell: bash