Skip to content

Deployment

Deployment #23

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