83 lines (67 loc) 路 1.82 KB
/
main.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
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Build and Deploy
on:
push:
branches: [ master ]
workflow_dispatch:
jobs:
quality:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: SonarQube Scan
uses: sonarsource/sonarqube-scan-action@master
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
build:
runs-on: ubuntu-latest
env:
NODE_ENV: production
COMPOSER_NO_DEV: 1
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: 'npm'
- name: Install Node packages
run: npm install
- name: Build assets
run: npm run build
- name: Setup PHP
uses: "shivammathur/setup-php@v2"
with:
php-version: 8.2
- name: Install Composer packages
uses: "ramsey/composer-install@v2"
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: AuthenticatorProWebsite
path: |
application
vendor
public
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: AuthenticatorProWebsite
- name: Prepare environment file
run: |
printf %s "${{ secrets.ENV_FILE }}" > .env
- name: Deploy with rsync
uses: burnett01/rsync-deployments@5.2
with:
switches: -avzr --delete
path: .
remote_path: /var/www/authenticatorpro/
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY }}