-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (54 loc) · 2.6 KB
/
Copy pathdeploy.yml
File metadata and controls
58 lines (54 loc) · 2.6 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
name: Deploy Website
on:
push:
branches: [main]
workflow_dispatch:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
# Deploy over EXPLICIT FTPS with curl (--ssl-reqd requires TLS — never plaintext)
# + retries. Same shared host as termpolis.com; it intermittently resets the
# control socket during the FTPS handshake (`read ECONNRESET`), so curl's
# --retry/--retry-all-errors rides out those transient resets.
#
# `-k` (insecure): this shared host serves an FTPS certificate that does NOT
# match FTP_HOST (curl error 60), so strict verification can't pass. The transfer
# stays TLS-ENCRYPTED; -k only skips server-identity verification.
#
# IMPORTANT: the codedev@codedev.llc FTP account's home is the shared public_html
# root (the SAME root that serves termpolis.com). codedev.llc is an addon domain
# whose document root is the "codedev.llc/" subfolder inside public_html, so we
# MUST upload under that prefix. Do NOT deploy to "/" — that overwrites the live
# termpolis.com files. --ftp-create-dirs creates remote dirs as needed.
# .github/, .gitignore, and README.md aren't web content.
- name: Deploy to codedev.llc (FTPS via curl, retried)
env:
FTP_HOST: ${{ secrets.FTP_HOST }}
FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
run: |
set -uo pipefail
if [ -z "${FTP_HOST:-}" ] || [ -z "${FTP_USERNAME:-}" ] || [ -z "${FTP_PASSWORD:-}" ]; then
echo "::notice::FTP secrets not set yet — skipping deploy. Add FTP_HOST, FTP_USERNAME, and FTP_PASSWORD (same values as termpolis-website), then re-run this workflow."
exit 0
fi
files=$(git ls-files | grep -vE '^(\.github/|\.gitignore$|README\.md$)')
rc=0; n=0; ok=0
while IFS= read -r f; do
[ -n "$f" ] && [ -f "$f" ] || continue
n=$((n+1))
if curl --ssl-reqd -k -sS --retry 5 --retry-all-errors --connect-timeout 30 \
--ftp-create-dirs --user "$FTP_USERNAME:$FTP_PASSWORD" \
-T "$f" "ftp://$FTP_HOST/codedev.llc/${f// /%20}"; then # %20-encode spaces in remote path
ok=$((ok+1))
else
echo " FAILED: $f"; rc=1
fi
done <<< "$files"
echo "Uploaded $ok/$n files to codedev.llc/."
if [ "$rc" -ne 0 ]; then echo "::error::One or more files failed to upload after retries."; fi
exit $rc