feat: add pipeline v2
This commit is contained in:
parent
1ed50c9969
commit
8322c871af
@ -22,3 +22,35 @@ steps:
|
||||
when:
|
||||
event: [ push, pull_request ]
|
||||
|
||||
- name: deploy
|
||||
image: alpine:3.20
|
||||
environment:
|
||||
DEPLOY_USER: rov
|
||||
DEPLOY_HOST: mangamochi.badger-pirarucu.ts.net
|
||||
DEPLOY_PORT: 22
|
||||
IMAGE: git.badger-pirarucu.ts.net/mangamochi/manga-matcher:${CI_COMMIT_SHA}
|
||||
secrets: [ DEPLOY_SSH_KEY ]
|
||||
commands:
|
||||
- echo "🚀 Deploying to $DEPLOY_HOST ..."
|
||||
- apk add --no-cache openssh-client docker-cli
|
||||
# Setup SSH key
|
||||
- mkdir -p ~/.ssh
|
||||
- echo "$DEPLOY_SSH_KEY" > ~/.ssh/id_rsa
|
||||
- chmod 600 ~/.ssh/id_rsa
|
||||
# Add host to known_hosts to prevent prompt
|
||||
- ssh-keyscan -p $DEPLOY_PORT $DEPLOY_HOST >> ~/.ssh/known_hosts
|
||||
# Run deployment commands remotely
|
||||
- >
|
||||
ssh -p $DEPLOY_PORT $DEPLOY_USER@$DEPLOY_HOST "
|
||||
docker pull $IMAGE &&
|
||||
docker stop manga-matcher || true &&
|
||||
docker rm manga-matcher || true &&
|
||||
docker run -d
|
||||
--name manga-matcher
|
||||
--restart always
|
||||
-p 8000:8000
|
||||
$IMAGE
|
||||
"
|
||||
when:
|
||||
event: [ push, pull_request ]
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user