Created
January 19, 2024 06:26
-
-
Save jack2jm/10bb459a83ca85f4589a25ea5c345050 to your computer and use it in GitHub Desktop.
This file contains 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
# 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 |
This file contains 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
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 |
This file contains 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
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