You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

44 lines
1.8 KiB

kind: pipeline
type: exec
name: deploy
trigger:
branch:
- main
event:
- push
clone:
disable: true
steps:
- name: deploy
environment:
DEPLOY_SSH_KEY:
from_secret: DEPLOY_SSH_KEY
DATABASE_URL:
from_secret: DATABASE_URL
STATIC_DIR:
from_secret: STATIC_DIR
TMP_DIR:
from_secret: TMP_DIR
NUXT_PUBLIC_SITE_URL:
from_secret: NUXT_PUBLIC_SITE_URL
BOOTSTRAP_ADMIN_USERNAME:
from_secret: BOOTSTRAP_ADMIN_USERNAME
BOOTSTRAP_ADMIN_PASSWORD:
from_secret: BOOTSTRAP_ADMIN_PASSWORD
commands:
- export HOME=/root
- mkdir -p "$HOME/.ssh"
- chmod 700 "$HOME/.ssh"
- 'printf "%s\n" "$DEPLOY_SSH_KEY" > "$HOME/.ssh/id_rsa"'
- chmod 600 "$HOME/.ssh/id_rsa"
- 'ssh-keyscan -p 8892 -H git.xieyaxin.top >> "$HOME/.ssh/known_hosts"'
- chmod 644 "$HOME/.ssh/known_hosts"
- 'export SSH_OPTS="-i $HOME/.ssh/id_rsa -o IdentitiesOnly=yes -o UserKnownHostsFile=$HOME/.ssh/known_hosts -o StrictHostKeyChecking=accept-new -o BatchMode=yes -o ConnectTimeout=10 -o ServerAliveInterval=15 -o ServerAliveCountMax=3"'
- 'ssh $SSH_OPTS -T -p 8892 root@git.xieyaxin.top || true'
- 'REPO_DIR="$HOME/projects/nuxt4-demo/nuxt4-demo"; if [ -d "$REPO_DIR/.git" ]; then GIT_SSH_COMMAND="ssh $SSH_OPTS" git -C "$REPO_DIR" fetch origin deploy-branch && git -C "$REPO_DIR" checkout -B deploy-branch origin/deploy-branch; else rm -rf "$REPO_DIR" && mkdir -p "$(dirname "$REPO_DIR")" && GIT_SSH_COMMAND="ssh $SSH_OPTS" git clone --depth 1 -b deploy-branch "ssh://root@git.xieyaxin.top:8892/topuser/nuxt4-demo.git" "$REPO_DIR"; fi'
- 'bash -lc "pm2 stop nuxt4-demo || true"'
- 'bash -lc "pm2 delete nuxt4-demo || true"'
- 'bash -lc "pm2 start ./run.sh --name nuxt4-demo"'