52 lines
1.5 KiB
Groovy
52 lines
1.5 KiB
Groovy
pipeline {
|
|
agent any
|
|
environment {
|
|
DEPLOY_PATH = '/var/www/codejava.tech'
|
|
}
|
|
stages {
|
|
stage('Install Dependencies') {
|
|
steps {
|
|
sh '''
|
|
# Install Hugo
|
|
curl -sL https://github.com/gohugoio/hugo/releases/download/v0.146.0/hugo_extended_0.146.0_linux-amd64.tar.gz \
|
|
-o hugo.tar.gz
|
|
tar -xzf hugo.tar.gz hugo
|
|
|
|
# Install Go
|
|
curl -sL https://go.dev/dl/go1.24.1.linux-amd64.tar.gz -o go.tar.gz
|
|
tar -xzf go.tar.gz
|
|
|
|
# Install rsync via static binary from pkgs.tailscale.com
|
|
curl -sL https://pkgs.tailscale.com/static/rsync/rsync-3.2.7-linux-amd64 \
|
|
-o rsync || \
|
|
curl -sL https://github.com/JBBgameich/rsync-static/releases/download/continuous/rsync-x86_64 \
|
|
-o rsync
|
|
chmod +x rsync
|
|
file ./rsync
|
|
'''
|
|
}
|
|
}
|
|
stage('Build') {
|
|
steps {
|
|
sh 'PATH=$PATH:$WORKSPACE/go/bin ./hugo --minify'
|
|
}
|
|
}
|
|
stage('Deploy') {
|
|
steps {
|
|
sh '''
|
|
./rsync -az --delete -e "ssh -o StrictHostKeyChecking=no" \
|
|
public/ root@172.17.0.1:${DEPLOY_PATH}/
|
|
'''
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
success {
|
|
echo 'Deployment successful! Visit https://codejava.tech'
|
|
}
|
|
failure {
|
|
echo 'Deployment failed!'
|
|
}
|
|
}
|
|
}
|