-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
62 lines (58 loc) · 1.6 KB
/
.gitlab-ci.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
variables:
BUILD_DIR: /home/gitlab-runner/builds/$CI_RUNNER_SHORT_TOKEN/0/bpvm-addon/woocommerce-product-voting-addon
DEPLOY_DIR: bpvm/wp-content/plugins/woocommerce-product-voting-addon
stages:
- build
- staging
- production
before_script:
- sudo apt-get install -y lftp && sudo apt-get install -y npm && sudo apt-get install -y curl
build:
stage: build
image: node:lts
tags:
- ci
- devops
only:
- staging
- production
script:
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
- export NVM_DIR="$HOME/.nvm"
- source "$NVM_DIR/nvm.sh"
- nvm install 14.1.0 #Add/Update Node Version.
- npm -v #NPM Version.
- node -v #"Node Version."
- echo "Installing Packages."
- npm install
- echo "Building artifacts and assets."
- npm run build
artifacts:
paths:
- $BUILD_DIR/assets # Replace with the actual path to your build directory
staging:
stage: staging
dependencies:
- build
only:
- staging
tags:
- ci
- devops
script:
- pwd
- echo "Updating plugin files.."
- lftp -e "set ssl:verify-certificate no; open $FTP_SHOST; user $FTP_SUSERNAME $FTP_SPASSWORD; mirror -X .* -X .*/ --reverse --verbose $BUILD_DIR /wpplugins/$DEPLOY_DIR; bye"
production:
stage: production
dependencies:
- build
only:
- production
tags:
- ci
- devops
script:
- pwd
- echo "Updating plugin files.."
- lftp -e "set ssl:verify-certificate no; open $FTP_HOST; user $FTP_PUSERNAME $FTP_PPASSWORD; mirror -X .* -X .*/ --reverse --verbose $BUILD_DIR /wpplugin/$DEPLOY_DIR; bye"