Last active
March 19, 2019 06:24
-
-
Save besrabasant/b96f8beb30af732ea4f624b013220110 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: node:8.15.0-jessie | |
build: | |
stage: build | |
only: | |
- master | |
script: | |
- cd site/web/app/themes/$THEME_DIR | |
- yarn && yarn build:production | |
artifacts: | |
paths: | |
- site/web/app/themes/$THEME_DIR/dist | |
cache: | |
paths: | |
- site/web/app/themes/$THEME_DIR/node_modules | |
deploy: | |
stage: deploy | |
before_script: | |
- apt-get update -qq && apt-get install -y -qq sshpass lftp | |
# when: manual | |
only: | |
- master | |
environment: | |
name: production | |
url: $WP_HOME | |
script: | |
- export SSHPASS=$USER_PASS | |
- chmod a+x generate-env.sh | |
- ./generate-env.sh $DB_NAME $DB_USER $DB_PASSWORD $WP_HOME $AUTH_KEY $SECURE_AUTH_KEY $LOGGED_IN_KEY $NONCE_KEY $AUTH_SALT $SECURE_AUTH_SALT $LOGGED_IN_SALT $NONCE_SALT > site/.env | |
- sshpass -e ssh -o stricthostkeychecking=no $USER_NAME@$HOST 'cd public_html/staging/<root_dir>/web/app && [ -L uploads ] && rm uploads' | |
- lftp -c "set ftp:ssl-allow no; open -u $USER_NAME,$USER_PASS $HOST; mirror -Rv site/ ./$ROOT_DIR --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/ --exclude .editorconfig --exclude .env.example --exclude .travis.yml --exclude CHANGELOG.md --exclude CODE_OF_CONDUCT.md --exclude dependencies.yml --exclude LICENSE.md --exclude phpcs.xml --exclude README.md --exclude wp-cli.yml" | |
- lftp -c "set ftp:ssl-allow no; open -u $USER_NAME,$USER_PASS $HOST; mirror -Rv site/web/app/themes/$THEME_DIR/dist ./$ROOT_DIR/web/app/themes/$THEME_DIR/dist --delete" | |
- sshpass -e ssh -o stricthostkeychecking=no $USER_NAME@$HOST 'cd public_html/staging/<root_dir>/web/app && tar -cvzf uploads.tar uploads/' | |
- sshpass -e ssh -o stricthostkeychecking=no $USER_NAME@$HOST 'cd public_html/staging/<root_dir>/web/app && rm -rf uploads/' | |
- sshpass -e ssh -o stricthostkeychecking=no $USER_NAME@$HOST 'mv public_html/staging/<root_dir>/web/app/uploads.tar ~/wp_uploads/<root_dir>/' | |
- sshpass -e ssh -o stricthostkeychecking=no $USER_NAME@$HOST 'cd wp_uploads/<root_dir>/ && tar -xvf uploads.tar && rm uploads.tar' | |
- sshpass -e ssh -o stricthostkeychecking=no $USER_NAME@$HOST 'cd public_html/staging/<root_dir>/web/app && ln -s ~/wp_uploads/<root_dir>/uploads/ uploads' | |
- sshpass -e ssh -o stricthostkeychecking=no $USER_NAME@$HOST 'cd public_html/staging/<root_dir> && composer install && composer update' | |
- sshpass -e ssh -o stricthostkeychecking=no $USER_NAME@$HOST 'cd public_html/staging/<root_dir>/web/app/themes/<theme_dir> && composer install && composer update' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment