Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Bhavya8181/a9f407aaf48901e2faefbe0a7d64ac97 to your computer and use it in GitHub Desktop.
Save Bhavya8181/a9f407aaf48901e2faefbe0a7d64ac97 to your computer and use it in GitHub Desktop.
# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.4
pipelines:
branches:
main:
- step:
name: Pulling code to server
caches:
- composer
script:
- apt-get update && apt-get install -y unzip
#- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#- composer install
- apt-get install openssh-server -y
#- echo $REPO_ORIGIN_URL
#- echo $REPO_GIT_USER_TOKEN
#- echo $REPO_GIT_USERNAME
#- echo $DEPLOY_USER_J
#- echo $DEPLOY_HOST_J
- echo $PROJECT_FOLDER_PATH
- ssh $DEPLOY_USER_J@$DEPLOY_HOST_J 'bash -s' < execute.sh $REPO_ORIGIN_URL $PROJECT_FOLDER_PATH
Here are basic steps to integrate Bitbucket pipeline - where project is already setuped to server.
*********Here is test to yml validtor - https://bitbucket-pipelines.atlassian.io/validator
Create varibles into bitbucket repo settings
*************************************************
REPO_ORIGIN_URL -> url to git pull with username and password
https://username:token@bitbucket.org/workspace/projectreponame.git
DEPLOY_USER_J -> server username
root
DEPLOY_HOST_J -> server ip address to connect
11.22.33.44
PROJECT_FOLDER_PATH -> navigate path to take pull
/var/www/html/ci-cd-laravel
echo "Folder path -> " . $2
cd $2
#git fetch
#git checkout main
#echo "pulling from -> " . $1
git pull $1
composer install
php artisan config:cache
php artisan migrate
php artisan storage:link
chmod -R 777 storage/
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment