Last active
February 7, 2024 08:18
-
-
Save Robiussani152/79fa67b2a9105627715a9c816ab67a61 to your computer and use it in GitHub Desktop.
Gitlab CI/CD pipeline yml file
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
--- | |
image: alpine:latest | |
stages: | |
- deploy | |
stage-deploy: | |
stage: deploy | |
environment: | |
name: staging | |
url: http://example.com | |
when: manual | |
before_script: | |
- 'command -v ssh-agent >/dev/null || ( apk add --update openssh )' | |
- eval $(ssh-agent -s) | |
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - | |
- mkdir -p ~/.ssh | |
- chmod 700 ~/.ssh | |
- ssh-keyscan -p $PORT $HOST >> ~/.ssh/known_hosts | |
- chmod 644 ~/.ssh/known_hosts | |
script: | |
- ssh -p $PORT $SSH_USER@$HOST "cd /deployed_path && git pull && more-commands" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment