-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.28 KB
/
deploy.yaml
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
# https://www.webstoemp.com/blog/github-actions-deploy-craftcms/
# https://swharden.com/blog/2022-04-24-github-actions-ftp/
# https://www.voorhoede.nl/en/blog/super-fast-npm-install-on-github-actions/
name: 🚀 FTP Deploy
on:
push:
branches:
- main
workflow_dispatch:
env:
WEB_PATH: ~/www/integration3
jobs:
ftp-deploy:
runs-on: ubuntu-latest
steps:
- name: 🛒 Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: npm-
- name: Install dependencies
run: npm ci --ignore-scripts
- name: 🏗️ create production build
run: npm run build
# Setup container with private SSH Key (used by rsync)
- name: 🔑 Load private SSH key
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
# RSYNC
- name: Deploy web files with rsync
run: |
rsync -azh --delete-after -e "ssh -o StrictHostKeyChecking=no" dist/ ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{env.WEB_PATH}}