-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (39 loc) · 1.3 KB
/
deploy.yml
File metadata and controls
45 lines (39 loc) · 1.3 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
name: Deploy to VPS via Cloudflare Tunnel
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# Install cloudflared
- name: Install Cloudflared
run: |
curl -L https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 \
-o cloudflared
chmod +x cloudflared
sudo mv cloudflared /usr/local/bin/cloudflared
# Setup SSH key
- name: Setup SSH Key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.VPS_SSH_KEY }}" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
# Deploy using Cloudflare SSH proxy
- name: Deploy on VPS
run: |
ssh -o StrictHostKeyChecking=no \
-o ProxyCommand="cloudflared access ssh --hostname ssh.fazleyrabbi.xyz" \
deploy@ssh.fazleyrabbi.xyz << 'EOF'
set -e
cd /var/www/app
git fetch origin
git reset --hard origin/main
docker compose up -d --build
mkdir -p storage bootstrap/cache
chmod -R 775 storage bootstrap/cache
docker compose exec app php artisan optimize:clear
EOF