-
-
Notifications
You must be signed in to change notification settings - Fork 3
44 lines (39 loc) · 1.31 KB
/
deploy-production.yml
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
name: Deployment
on:
push:
branches: main
workflow_dispatch:
jobs:
deployment:
runs-on: ubuntu-latest
environment:
name: kindlingx
url: https://kindlingx.com
steps:
- uses: actions/checkout@v3
- name: Set up Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: 16.x
- uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: ${{ secrets.WEBSITE_PRIVATE_KEY }}
- name: Build and Deploy
env:
WEBSITE_HOST: ${{ secrets.WEBSITE_HOST }}
WEBSITE_PATH: ${{ secrets.WEBSITE_PATH }}
run: |
# Set the real domain
sed -i 's|'https://kindlingproject.netlify.app/'|'https://kindlingx.com/'|g' config/production/config.toml
# Build the website
npm install && npm run build
# Compress and transfer the tarball
cd public && tar -cvzf public.tar.gz *
scp -o StrictHostKeyChecking=no public.tar.gz "$WEBSITE_HOST":$WEBSITE_PATH/..
# Update the website
ssh -o StrictHostKeyChecking=no "$WEBSITE_HOST" << eof
echo "Removing the old files..."
cd $WEBSITE_PATH && rm -rf *
echo "Deploying the site..."
mv ../public.tar.gz . && tar -xvf public.tar.gz
eof