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.
73 lines
2.3 KiB
73 lines
2.3 KiB
---
|
|
resources:
|
|
- name: git-resource
|
|
type: git
|
|
icon: git
|
|
source:
|
|
uri: ssh://git@git.nulloctet.com:8437/sothr/sothr-dot-com.git
|
|
private_key: |
|
|
((pull_key))
|
|
ignore_paths:
|
|
- pipeline.yml
|
|
- upload_pipeline.sh
|
|
- README.md
|
|
|
|
jobs:
|
|
- name: publish
|
|
plan:
|
|
- get: git-resource
|
|
trigger: true
|
|
- task: build-site
|
|
config:
|
|
platform: linux
|
|
image_resource:
|
|
type: registry-image
|
|
source:
|
|
repository: ((nexus_docker_read.host))/sothr/hugo
|
|
username: ((nexus_docker_read.username))
|
|
password: ((nexus_docker_read.password))
|
|
inputs:
|
|
- name: git-resource
|
|
outputs:
|
|
- name: site-html
|
|
params:
|
|
HUGO_THEME: pure
|
|
HUGO_BASEURL: https://sothr.com/
|
|
run:
|
|
path: /bin/sh
|
|
args:
|
|
- -c
|
|
- |
|
|
export HUGO_SOURCE="${PWD}/git-resource"
|
|
/run.sh --minify
|
|
tar -czvf site-html/website.tgz -C /output/ .
|
|
- task: publish-site
|
|
config:
|
|
platform: linux
|
|
image_resource:
|
|
type: registry-image
|
|
source:
|
|
repository: ((nexus_docker_read.host))/sothr/deploy
|
|
tag: "stable"
|
|
username: ((nexus_docker_read.username))
|
|
password: ((nexus_docker_read.password))
|
|
inputs:
|
|
- name: site-html
|
|
params:
|
|
DEPLOY_KEY: ((deploy.key))
|
|
DEPLOY_HOST: ((deploy.host))
|
|
DEPLOY_PORT: ((deploy.port))
|
|
DEPLOY_USER: ((deploy.user))
|
|
DEPLOY_TARGET: ((deploy.target))
|
|
run:
|
|
path: /bin/bash
|
|
args:
|
|
- -c
|
|
- |
|
|
eval `ssh-agent -s`
|
|
ssh-add <(echo "${DEPLOY_KEY}")
|
|
mkdir -p ~/.ssh
|
|
ssh-keyscan -p ${DEPLOY_PORT} ${DEPLOY_HOST} >> ~/.ssh/known_hosts
|
|
mkdir /tmp/deploy
|
|
tar -xzvf site-html/website.tgz -C /tmp/deploy
|
|
rsync -avz --delete-delay -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -p ${DEPLOY_PORT}" --progress /tmp/deploy/* ${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_TARGET}
|