Skip to content

Commit 058e298

Browse files
committed
feat(ci): add preview deployments
1 parent a77e452 commit 058e298

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Build and deploy to DreamHost via sshpass
2+
3+
on:
4+
push
5+
6+
jobs:
7+
deploy:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v4
12+
13+
- name: Install pnpm
14+
uses: pnpm/action-setup@v4
15+
with:
16+
run_install: false
17+
18+
- name: Install Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: 20
22+
cache: 'pnpm'
23+
24+
- name: Install dependencies
25+
run: pnpm install
26+
27+
- name: Install sshpass
28+
run: sudo apt-get install -y sshpass
29+
30+
- name: Add SSH Key to known_hosts
31+
env:
32+
KNOWN_HOSTS_ENTRY: ${{ secrets.KNOWN_HOSTS_ENTRY }}
33+
HOST: ${{ secrets.HOST }}
34+
run: |
35+
mkdir -p ~/.ssh
36+
echo "$KNOWN_HOSTS_ENTRY" >> ~/.ssh/known_hosts
37+
chmod 644 ~/.ssh/known_hosts
38+
39+
- name: Build static site
40+
run: pnpm build
41+
42+
- name: Deploy via rsync and sshpass
43+
env:
44+
USERNAME: ${{ secrets.USERNAME }}
45+
PASSWORD: ${{ secrets.PASSWORD }}
46+
HOST: ${{ secrets.HOST }}
47+
DEPLOY_PATH: preview.departuremono.com
48+
run: |
49+
sshpass -p "$PASSWORD" rsync -avz --delete ./dist/* $USERNAME@$HOST:$DEPLOY_PATH

0 commit comments

Comments
 (0)