fix CI
This commit is contained in:
parent
5e78e67fc8
commit
95bdf4615d
1 changed files with 63 additions and 16 deletions
|
|
@ -1,12 +1,13 @@
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- deploy
|
- deploy
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
COMPOSER_ALLOW_SUPERUSER: '1'
|
COMPOSER_ALLOW_SUPERUSER: '1'
|
||||||
|
|
||||||
build:
|
build_prod:
|
||||||
stage: build
|
stage: build
|
||||||
|
only:
|
||||||
|
- prod
|
||||||
image: composer:2
|
image: composer:2
|
||||||
script:
|
script:
|
||||||
- apk add --no-cache nodejs npm
|
- apk add --no-cache nodejs npm
|
||||||
|
|
@ -23,7 +24,27 @@ build:
|
||||||
paths:
|
paths:
|
||||||
- node_modules/
|
- node_modules/
|
||||||
|
|
||||||
deploy:
|
build_preprod:
|
||||||
|
stage: build
|
||||||
|
only:
|
||||||
|
- preprod
|
||||||
|
image: composer:2
|
||||||
|
script:
|
||||||
|
- apk add --no-cache nodejs npm
|
||||||
|
- npm install
|
||||||
|
- npm run build:preprod
|
||||||
|
- cd dist -
|
||||||
|
composer install --no-dev --optimize-autoloader --ignore-platform-req=ext-gd
|
||||||
|
- cd ..
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- dist/
|
||||||
|
cache:
|
||||||
|
key: ${CI_COMMIT_REF_SLUG}
|
||||||
|
paths:
|
||||||
|
- node_modules/
|
||||||
|
|
||||||
|
deploy_prod:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
image: node:latest
|
image: node:latest
|
||||||
only:
|
only:
|
||||||
|
|
@ -33,18 +54,44 @@ deploy:
|
||||||
script:
|
script:
|
||||||
- cd dist
|
- cd dist
|
||||||
- |
|
- |
|
||||||
rsync_deploy() {
|
rsync_deploy() {
|
||||||
local src=$1
|
local src=$1
|
||||||
local dst=$2
|
local dst=$2
|
||||||
local exclude=$3
|
local exclude=$3
|
||||||
cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O"
|
cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O"
|
||||||
[[ -n $exclude ]] && cmd="$cmd $exclude"
|
[[ -n $exclude ]] && cmd="$cmd $exclude"
|
||||||
cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst"
|
cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst"
|
||||||
echo "$cmd"
|
echo "$cmd"
|
||||||
eval $cmd
|
eval $cmd
|
||||||
}
|
}
|
||||||
|
|
||||||
rsync_deploy site/ "$PROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'"
|
rsync_deploy site/ "$PROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'"
|
||||||
rsync_deploy vendor/ "$PROD_PATH/vendor/"
|
rsync_deploy vendor/ "$PROD_PATH/vendor/"
|
||||||
rsync_deploy kirby/ "$PROD_PATH/kirby/"
|
rsync_deploy kirby/ "$PROD_PATH/kirby/"
|
||||||
rsync_deploy assets/ "$PROD_PATH/assets/" "--exclude 'tiles/'"
|
rsync_deploy assets/ "$PROD_PATH/assets/" "--exclude 'tiles/'"
|
||||||
|
|
||||||
|
deploy_preprod:
|
||||||
|
stage: deploy
|
||||||
|
image: node:latest
|
||||||
|
only:
|
||||||
|
- preprod
|
||||||
|
before_script:
|
||||||
|
- apt-get update -qq && apt-get install -y rsync sshpass
|
||||||
|
script:
|
||||||
|
- cd dist
|
||||||
|
- |
|
||||||
|
rsync_deploy() {
|
||||||
|
local src=$1
|
||||||
|
local dst=$2
|
||||||
|
local exclude=$3
|
||||||
|
cmd="sshpass -p \"$PASSWORD\" rsync -az --delete -O"
|
||||||
|
[[ -n $exclude ]] && cmd="$cmd $exclude"
|
||||||
|
cmd="$cmd -e 'ssh -p 2244 -o StrictHostKeyChecking=no' $src $USERNAME@$HOST:$dst"
|
||||||
|
echo "$cmd"
|
||||||
|
eval $cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
rsync_deploy site/ "$PREPROD_PATH/site/" "--exclude 'accounts/' --exclude 'cache/' --exclude 'sessions/'"
|
||||||
|
rsync_deploy vendor/ "$PREPROD_PATH/vendor/"
|
||||||
|
rsync_deploy kirby/ "$PREPROD_PATH/kirby/"
|
||||||
|
rsync_deploy assets/ "$PREPROD_PATH/assets/" "--exclude 'tiles/'"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue