-
Notifications
You must be signed in to change notification settings - Fork 0
112 lines (100 loc) · 3.39 KB
/
Copy pathdeploy.yml
File metadata and controls
112 lines (100 loc) · 3.39 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: Deploy to replace.kineticgain.com
# Hostinger FTP deploy — Vite/React build → dist/ → /replace/ on Hostinger.
# Replaces GitHub Pages deployment (pages.yml.disabled).
#
# Required secrets in repo Settings → Secrets and variables → Actions:
# FTP_SERVER — Hostinger FTP hostname (e.g. ftp.kineticgain.com)
# FTP_USERNAME — Hostinger FTP user
# FTP_PASSWORD — Hostinger FTP password
# Same convention as cert / jml / mt / pv / scopes.
on:
push:
branches: [main]
paths-ignore:
- '**.md'
- 'CHANGELOG.md'
- 'LICENSE'
- 'docs/**'
- 'screenshots/**'
- 'fixtures/**'
- 'coverage/**'
workflow_dispatch:
permissions:
contents: read
concurrency:
group: deploy-vendor-replacement-intelligence
cancel-in-progress: false
jobs:
build-deploy:
name: Build + FTP-sync to replace.kineticgain.com
runs-on: ubuntu-latest
timeout-minutes: 12
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Node
uses: actions/setup-node@v6
with:
node-version: '22'
cache: npm
- name: Install
run: npm ci || npm install
- name: Build
run: |
# Prefer prerender (static-output) over build if both exist
if npm run | grep -q "^ prerender$"; then
npm run prerender
else
npm run build
fi
- name: Verify build output
run: |
# Find the build output dir — Vite default is dist/
if [ -d "dist" ]; then
DEPLOY_DIR="dist"
elif [ -d "build" ]; then
DEPLOY_DIR="build"
elif [ -d "site" ]; then
DEPLOY_DIR="site"
else
echo "FAIL: No dist/, build/, or site/ directory produced"
exit 1
fi
echo "DEPLOY_DIR=$DEPLOY_DIR" >> $GITHUB_ENV
echo "Build output found in: $DEPLOY_DIR"
ls -lah "$DEPLOY_DIR" | head -20
test -f "$DEPLOY_DIR/index.html" || (echo "FAIL: $DEPLOY_DIR/index.html missing" && exit 1)
- name: FTP Deploy
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ secrets.FTP_SERVER }}
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
local-dir: ./${{ env.DEPLOY_DIR }}/
server-dir: /replace/
exclude: |
**/.git*
**/.git*/**
**/.github/**
**/node_modules/**
**/.DS_Store
- name: Verify live
run: |
sleep 30
# Try HTTPS first; fall back to HTTP for cases where SSL is still propagating
if curl -fsSL --max-time 15 "https://replace.kineticgain.com/" > /tmp/live.html; then
echo "OK: HTTPS live at https://replace.kineticgain.com/"
elif curl -fsSL --max-time 15 "http://replace.kineticgain.com/" > /tmp/live.html; then
echo "WARN: HTTP live but HTTPS not ready (DNS/cert may still be propagating)"
else
echo "FAIL: neither HTTPS nor HTTP responding"
exit 1
fi
# Sanity: title or some content should be there
if grep -q "html" /tmp/live.html; then
echo "OK: live page returned HTML"
else
echo "FAIL: live response is not HTML"
head /tmp/live.html
exit 1
fi