-
-
Notifications
You must be signed in to change notification settings - Fork 3
46 lines (40 loc) · 1.41 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
45
46
name: Deployment
on:
workflow_dispatch:
jobs:
deployment:
runs-on: ubuntu-latest
environment:
name: kindlingx
url: http://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/[email protected]
with:
ssh-private-key: ${{ secrets.WEBSITE_HOST_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/'|'http://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 *
# Add the host key
hostKey='kindlingx.com ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIfN3rkIrcVwFzs1oRYQ+pmyHmNbRWvikxRl7pRPVL/2'
echo "$hostKey" >> ~/.ssh/known_hosts
scp public.tar.gz "$WEBSITE_HOST":$WEBSITE_PATH/..
# Update the website
ssh "$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