Last active
September 11, 2023 06:30
-
-
Save qumberrizvi/0a34edc7af96bd6a8b00081229261627 to your computer and use it in GitHub Desktop.
Bitbucket Pipelines CI/CD: SSH into a server to git pull without conflict. Avoid failure when auto merge tries to open editor for commit message.
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.1.29 | |
pipelines: | |
default: | |
- step: | |
name: Deploy to dev | |
deployment: dev | |
# trigger: manual # Uncomment to make this a manual deployment. | |
script: | |
- echo "Deploying to dev..." | |
- pipe: atlassian/ssh-run:0.2.5 | |
variables: | |
SSH_USER: 'root' | |
SERVER: '82.xxx.xx.xx5' | |
MODE: 'command' | |
COMMAND: 'cd /home/ubuntu/public_html/dev/ && \ | |
git add . && \ | |
git commit -a -m "local files server commit" && \ | |
(echo "OK"; exit 0) || (c=$?; echo "NOK"; (exit 0)) && \ | |
git pull origin feature/development -X theirs --no-commit && \ | |
git commit -m "Merge" && \ | |
(echo "OK."; exit 0) || (c=$?; echo "NOK"; (exit 0))' | |
- echo "Deployed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment