-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (64 loc) · 2.5 KB
/
Copy pathdeploy.yml
File metadata and controls
76 lines (64 loc) · 2.5 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
name: Deploy Static Site to VPS
on:
push:
branches:
- master
workflow_dispatch:
concurrency:
group: production-deploy
cancel-in-progress: true
jobs:
deploy:
name: Deploy static HTML
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
- name: Test SSH connection
run: |
ssh -i ~/.ssh/deploy_key \
-o IdentitiesOnly=yes \
-p "${{ secrets.SSH_PORT }}" \
"${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}" \
"whoami && hostname"
- name: Deploy public folder
run: |
rsync -az --delete \
--exclude='.well-known/' \
--exclude='.htaccess' \
--exclude='api/.printful-token' \
--exclude='api/.stripe-secret' \
--exclude='api/.stripe-webhook-secret' \
--exclude='api/.price-multiplier' \
--exclude='api/.inscription-promo' \
--exclude='api/.inscription-current' \
--exclude='api/.inscription-notify' \
--exclude='api/.inscription-notify-from' \
--exclude='api/.smtp' \
--exclude='api/inscriptions.jsonl' \
-e "ssh -i ~/.ssh/deploy_key -o IdentitiesOnly=yes -p ${{ secrets.SSH_PORT }}" \
public/ \
"${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.DEPLOY_PATH }}/"
- name: Fix ownership and permissions
run: |
ssh -i ~/.ssh/deploy_key \
-o IdentitiesOnly=yes \
-p "${{ secrets.SSH_PORT }}" \
"${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}" \
"chown -R capoeiracuernava:capoeiracuernava '${{ secrets.DEPLOY_PATH }}' && find '${{ secrets.DEPLOY_PATH }}' -type d -exec chmod 755 {} \; && find '${{ secrets.DEPLOY_PATH }}' -type f -exec chmod 644 {} \;"
- name: Clear cPanel NGINX cache
run: |
ssh -i ~/.ssh/deploy_key \
-o IdentitiesOnly=yes \
-p "${{ secrets.SSH_PORT }}" \
"${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}" \
"/usr/local/cpanel/scripts/ea-nginx clear_cache capoeiracuernava && /usr/local/cpanel/scripts/ea-nginx reload"