Created
September 11, 2023 11:52
-
-
Save arif98741/e269ea7eded1ccd448a0669de4f89709 to your computer and use it in GitHub Desktop.
Gitlab Runner
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
stages: | |
- build | |
- test | |
- deploy | |
variables: | |
APP_NAME: "your-app-name" | |
SERVER_USER: "your-server-user" | |
SERVER_HOST: "your-server-host" | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
before_script: | |
- apt-get update && apt-get install -y sshpass | |
build: | |
stage: build | |
variables: | |
PHP_VERSION: "8.1" | |
before_script: | |
- apt-get update && apt-get install -y software-properties-common | |
- add-apt-repository --remove ppa:mc3man/trusty-media | |
script: | |
- echo "hello build stage" | |
test: | |
stage: test | |
script: | |
- echo "hello test stage" | |
deploy: | |
stage: deploy | |
script: | |
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - | |
- echo "access inside server" | |
- sshpass -p $SERVER_PASSWORD ssh -o StrictHostKeyChecking=no $SERVER_USER@$SERVER_HOST "cd /var/www/html/test && git pull" | |
environment: | |
name: production | |
# only: | |
# - master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment