-
Notifications
You must be signed in to change notification settings - Fork 1
70 lines (56 loc) · 2.09 KB
/
deploy.yml
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
name: 🚀 Deploy
on:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
env:
BUILD_SOURCE_DIR: .
BUILD_ARTIFACT_STAGING_DIR: build/
BUILD_ARTIFACT_DESTINATION_DIR: /domains/ysbrand.dev/deployment/uploads/
steps:
- name: 🛎️ Checkout project
uses: actions/checkout@v3
- name: 🔍 Read .env
run: grep -E 'PHP_VERSION|NODE_VERSION' .env.prod >> $GITHUB_ENV
- name: 🖱️ Setup PHP v${{ env.PHP_VERSION }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ env.PHP_VERSION }}
- name: 📥 Install back-end dependencies
run: composer install --no-interaction --prefer-dist --no-dev --optimize-autoloader
- name: 🖱️ Set Node v${{ env.NODE_VERSION }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: npm
- name: 📥 Install front-end dependencies
run: npm ci --ignore-scripts
- name: 🔨 build front-end
run: npm run build
- name: 🗑️ Remove storage directory
run: rm -rf storage
- name: 📁 Create build directory
run: mkdir ${{ env.BUILD_ARTIFACT_STAGING_DIR }}
- name: 🗄️ ZIP Build
uses: TheDoctor0/[email protected]
with:
filename: ${{ env.BUILD_ARTIFACT_STAGING_DIR }}build.zip
path: ${{ env.BUILD_SOURCE_DIR }}
exclusions: 'storage/* build/* node_modules/*'
- name: ➗ Calculate checksum
run: openssl md5 ${{ env.BUILD_ARTIFACT_STAGING_DIR }}build.zip | cut -d" " -f2 > ${{ env.BUILD_ARTIFACT_STAGING_DIR }}checksum.txt
- name: 📂 Sync files
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.HOST_SERVER }}
username: ${{ secrets.FTP_USER }}
password: ${{ secrets.FTP_PASSWORD }}
local-dir: ${{ env.BUILD_ARTIFACT_STAGING_DIR }}
server-dir: ${{ env.BUILD_ARTIFACT_DESTINATION_DIR }}