diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5d7a3b5..1cee6b7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,14 +5,18 @@ stages: variables: REGISTRY: registry.gitlab.com/$CI_PROJECT_PATH -.deploy_setup: &deploy_setup - image: alpine:latest +.deploy_template: &deploy_setup + stage: deploy + image: alpine:3.20 before_script: - apk add --no-cache openssh-client - - eval $(ssh-agent -s) - - echo "$VPS_SSH_KEY" | ssh-add - - mkdir -p ~/.ssh - - echo "$VPS_HOST_KEY" >> ~/.ssh/known_hosts + - echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_ed25519 + - chmod 600 ~/.ssh/id_ed25519 + - ssh-keyscan -H $VPS_HOST >> ~/.ssh/known_hosts + environment: + name: production + url: https://balexvic.com publish: stage: publish @@ -32,7 +36,6 @@ publish: deploy: <<: *deploy_setup - stage: deploy needs: [publish] rules: - if: $CI_COMMIT_BRANCH == "main"