-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
44 lines (38 loc) · 1.32 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
stages:
- build
- test
- deploy
job 0:
stage: .pre
script: /scripts/beforebuild.sh
job 1:
stage: build
script: /scripts/build.sh
job 2:
stage: test
script: cd /app && sudo php artisan test
job 3:
stage: test
script: cd /app && sudo php artisan dusk
job 4:
stage: deploy
script:
- export BUILD_NAME=$(cat /scripts/build-name)
- export BUILD_VERSION=$(cat /scripts/build-version)
- export BUILD_NUMBER=$CI_PIPELINE_ID
- export BUILD_DATE="$(date +%Y%m%d)"
- export BUILD_CATALOG=/git/$BUILD_NAME-$BUILD_VERSION
- export BUILD_TAR=/git/$BUILD_NAME-$BUILD_VERSION-$BUILD_NUMBER-$BUILD_DATE.tar
- echo 'Begining production build:' $BUILD_NAME $BUILD_VERSION $BUILD_DATE $BUILD_NUMBER
- sudo rm -r -f $BUILD_CATALOG
- sudo mkdir $BUILD_CATALOG
- echo 'Copying build from /app'
- sudo rsync -qrv --exclude-from=/scripts/build-exclude /app/* $BUILD_CATALOG
- echo 'Installing vendor libraries with --no-dev'
- cd $BUILD_CATALOG && sudo composer install --no-dev --no-scripts --no-suggest
- cd $BUILD_CATALOG && sudo tar -cf $BUILD_TAR * && sudo gzip $BUILD_TAR
- sudo cp $BUILD_TAR.gz /git/$BUILD_NAME-$BUILD_VERSION-latest.tar.gz
- sudo cp $BUILD_TAR.gz /git/$BUILD_NAME-latest.tar.gz
job 5:
stage: .post
script: /scripts/postbuild.sh