Skip to content

Commit d5eaf90

Browse files
committed
Add CI deployment
1 parent 342b9fb commit d5eaf90

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Web Deployment
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-24.04
11+
env:
12+
BASE_URL: https://keila.io
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/cache@v2
16+
with:
17+
path: |
18+
~/.npm
19+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
20+
- run: |
21+
# Install Node
22+
sudo apt update && sudo apt install nodejs
23+
24+
# Install packages and build
25+
npm ci
26+
npm run build
27+
28+
# Add SSH key
29+
mkdir ~/.ssh
30+
echo "${{ secrets.DEPLOY_KEY }}" > ~/.ssh/id_rsa
31+
echo "${{ secrets.KNOWN_HOSTS }}" > ~/.ssh/known_hosts
32+
chmod 600 ~/.ssh/*
33+
34+
# Deploy
35+
DEPLOY_TARGET=${{ secrets.DEPLOY_TARGET }} npm run deploy

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"build": "astro build",
99
"preview": "astro preview",
1010
"astro": "astro",
11-
"format": "prettier --write ."
11+
"format": "prettier --write .",
12+
"deploy": "rsync -avz ./dist/ $DEPLOY_TARGET"
1213
},
1314
"dependencies": {
1415
"@astrojs/alpinejs": "^0.4.0",

0 commit comments

Comments
 (0)