forked from cassaiub/ast100
-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (48 loc) · 1.96 KB
/
Copy pathdeploy.yml
File metadata and controls
57 lines (48 loc) · 1.96 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
name: Deploy to Bluehost — cassa.bd/courses/ast100
on:
push:
branches: [main]
# Manual re-run from the Actions tab without needing a new commit.
workflow_dispatch:
# Cancel an in-flight run if a newer push arrives on the same branch.
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
name: Build & Sync to Bluehost
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22 # matches package.json engines (>=22.12.0)
cache: npm # cache ~/.npm across runs
- name: Install dependencies (npm ci)
run: npm ci
- name: Build Astro static site
run: npm run build
# Write the CI deploy key + pinned host key. These are the SAME
# credentials as the sibling `cassa` repo (rotated 2026-06-04).
# IdentitiesOnly=yes is essential: it offers ONLY this key, avoiding the
# server's "Too many authentication failures" disconnect.
- name: Configure SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.BLUEHOST_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
echo "${{ secrets.BLUEHOST_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
# rsync ./dist/ → public_html/courses/ast100/ on Bluehost. --delete
# mirrors the build into THIS sub-directory only; it cannot touch the
# sibling sites (the root / and /abekta) because they live outside the
# destination path.
- name: Deploy with rsync
run: |
rsync -avz --delete --human-readable \
-e "ssh -i ~/.ssh/deploy_key -o IdentitiesOnly=yes -o UserKnownHostsFile=~/.ssh/known_hosts" \
dist/ \
"${{ secrets.BLUEHOST_USER }}@${{ secrets.BLUEHOST_HOST }}:public_html/courses/ast100/"