mirror of
https://github.com/Start9Labs/start9.com.git
synced 2026-03-30 20:14:50 +00:00
add CI/CD workflow to build and deploy site to VPS
Builds with slinkity and rsyncs _site/ to /var/www/html/start9.com/ on push to master. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
47
.github/workflows/deploy.yml
vendored
Normal file
47
.github/workflows/deploy.yml
vendored
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
name: Build and deploy website
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["master"]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: "deploy"
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Build site
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Configure SSH
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
|
||||||
|
chmod 600 ~/.ssh/deploy_key
|
||||||
|
ssh-keyscan -H start9.com >> ~/.ssh/known_hosts
|
||||||
|
cat >> ~/.ssh/config <<EOF
|
||||||
|
Host website-vps
|
||||||
|
HostName start9.com
|
||||||
|
User root
|
||||||
|
IdentityFile ~/.ssh/deploy_key
|
||||||
|
IdentitiesOnly yes
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Deploy to VPS
|
||||||
|
run: rsync -az --delete _site/ website-vps:/var/www/html/start9.com/
|
||||||
Reference in New Issue
Block a user