diff --git a/.gitattributes b/.gitattributes index e69de29..6b91726 100644 --- a/.gitattributes +++ b/.gitattributes @@ -0,0 +1,2 @@ +build/* linguist-vendored +config/* linguist-vendored \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..61044ff --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +[![CodeFactor](https://www.codefactor.io/repository/github/simon987/simon987.net/badge/master)](https://www.codefactor.io/repository/github/simon987/simon987.net/overview/master) +[![Build Status](https://ci.simon987.net/buildStatus/icon?job=simon987.net)](https://ci.simon987.net/job/simon987.net/) + + + diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile new file mode 100644 index 0000000..0c60efc --- /dev/null +++ b/jenkins/Jenkinsfile @@ -0,0 +1,47 @@ +def remote = [:] +remote.name = 'remote' +remote.host = env.DEPLOY_HOST +remote.user = env.DEPLOY_USER +remote.identityFile = '/var/lib/jenkins/.ssh/id_rsa' +remote.knownHosts = '/var/lib/jenkins/.ssh/known_hosts' +remote.allowAnyHosts = true +remote.retryCount = 3 +remote.retryWaitSec = 3 +logLevel = 'FINER' + +pipeline { + agent none + environment { + HOME='.' + } + stages { + stage('Build') { + agent { + docker { + image 'node:10-alpine' + } + } + steps { + sh 'cd simon987/ && npm install' + sh 'cd simon987/ && npm audit fix' + sh 'cd simon987/ && npm run build' + sh 'mv simon987/dist webroot' + stash includes: 'webroot/', name: 'webdist' + } + } + stage('Deploy') { + agent none + steps { + node('master') { + unstash 'webdist' + sshCommand remote: remote, command: "cd simon987 && rm -rf webroot/* deploy.sh" + sshPut remote: remote, from: 'webroot/', into: 'simon987' + sshPut remote: remote, from: 'jenkins/deploy.sh', into: 'simon987/' + sshCommand remote: remote, command: 'chmod +x simon987/deploy.sh && ./simon987/deploy.sh' + } + } + } + } +} + + diff --git a/jenkins/deploy.sh b/jenkins/deploy.sh new file mode 100755 index 0000000..49500bb --- /dev/null +++ b/jenkins/deploy.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +export TTROOT="simon987" + +chmod 755 -R "${TTROOT}/webroot"