-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatic-react-deploy.yml
More file actions
42 lines (35 loc) · 1.18 KB
/
Copy pathstatic-react-deploy.yml
File metadata and controls
42 lines (35 loc) · 1.18 KB
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
# .github/workflows/deploy.yml
# Copy this to each static/React site repo and fill in the env vars
name: Deploy
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# -- For React sites: build first
# Remove these two steps for plain static HTML sites
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Build
run: |
npm ci
npm run build
env:
VITE_API_URL: ${{ secrets.API_URL }}
# Add any other build-time env vars here
# -- Deploy built files (use 'dist' for React, '.' for static HTML)
- name: Deploy
uses: appleboy/scp-action@v0.1.7
with:
host: ${{ secrets.SERVER_HOST }}
username: deploy
key: ${{ secrets.SSH_DEPLOY_KEY }}
source: "dist/" # Change to '.' for static HTML, adjust for your build output dir
target: "/var/www/static/YOUR_SITE_NAME" # Match the --name used in ./site add
strip_components: 1 # Removes the 'dist/' prefix so files land directly in target