ci: add Jenkinsfile and deploy script

Necessary to build in our own CI and publish via Caddy-Git.

Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
Jakub Sokołowski 2021-11-15 14:30:06 +01:00 committed by Jakub
parent 06db81da79
commit d993eb148f
10 changed files with 3163 additions and 19 deletions

2
.gitignore vendored
View File

@ -1,3 +1,5 @@
.jekyll-cache
.jekyll-metadata
_site/
node_modules/
yarn-error.log

View File

@ -27,7 +27,7 @@ bundle install
To simply build the site use:
```
bundle exec jekyll build --config _config_local.yml
bundle exec jekyll build --config _config_local.yml
```
This will generate the site files and put them under `_site`.

View File

@ -1,4 +1,5 @@
source "https://rubygems.org"
gem "just-the-docs"
gem "jekyll-sitemap"
gem "kramdown-parser-gfm"

View File

@ -5,16 +5,16 @@ GEM
public_suffix (>= 2.0.2, < 5.0)
colorator (1.1.0)
concurrent-ruby (1.1.9)
em-websocket (0.5.2)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.15.4)
forwardable-extended (2.6.0)
http_parser.rb (0.6.0)
i18n (1.8.10)
http_parser.rb (0.8.0)
i18n (1.8.11)
concurrent-ruby (~> 1.0)
jekyll (4.2.0)
jekyll (4.2.1)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
@ -33,6 +33,8 @@ GEM
sassc (> 2.0.1, < 3.0)
jekyll-seo-tag (2.7.1)
jekyll (>= 3.8, < 5.0)
jekyll-sitemap (1.4.0)
jekyll (>= 3.7, < 5.0)
jekyll-watch (2.2.1)
listen (~> 3.0)
just-the-docs (0.3.3)
@ -44,30 +46,31 @@ GEM
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.3)
listen (3.6.0)
listen (3.7.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (4.0.6)
rake (13.0.1)
rake (13.0.6)
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.5)
rouge (3.26.0)
rouge (3.26.1)
safe_yaml (1.0.5)
sassc (2.4.0)
ffi (~> 1.9)
terminal-table (2.0.0)
unicode-display_width (~> 1.1, >= 1.1.1)
unicode-display_width (1.7.0)
unicode-display_width (1.8.0)
PLATFORMS
ruby
DEPENDENCIES
jekyll-sitemap
just-the-docs
kramdown-parser-gfm

43
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,43 @@
pipeline {
agent { label 'linux' }
options {
disableConcurrentBuilds()
/* manage how many builds we keep */
buildDiscarder(logRotator(
numToKeepStr: '20',
daysToKeepStr: '30',
))
}
environment {
GIT_AUTHOR_NAME = 'status-im-auto'
GIT_AUTHOR_EMAIL = 'auto@status.im'
/* Avoid need for sudo when using bundler. */
GEM_HOME = "${env.HOME}/.gem"
}
stages {
stage('Deps') {
steps {
sh 'yarn install --ignore-optional'
sh 'bundle install'
}
}
stage('Build') {
steps {
sh 'bundle exec jekyll build'
}
}
stage('Publish Prod') {
when { expression { env.GIT_BRANCH ==~ /.*master/ } }
steps {
sshagent(credentials: ['status-im-auto-ssh']) {
sh 'yarn run deploy'
}
}
}
}
}

View File

@ -45,3 +45,7 @@ be useful outside of Status as well. To the extent that these protocols are used
within Status clients, they will show up as SIPs in the future.
To see more on this, please visit the current home: [vac protocol](https://specs.vac.dev).
# Continuous Integration
The site is built in [Our Jenkins CI](https://ci.status.im/job/website/job/specs.status.im/) based off of `master` branch.

View File

@ -1,5 +1,5 @@
title: "Status Specification"
remote_theme: pmarsceill/just-the-docs
theme: just-the-docs
color_scheme: "light"
search_enabled: true
url: "https://specs.status.im"

View File

@ -1,5 +1,16 @@
{
"name": "specs",
"version": "0.0.0",
"scripts": {
"textlint": "textlint docs/",
"lint": "remark .",
"deploy": "node scripts/deploy.js"
},
"remarkConfig": {
"plugins": [
"remark-preset-lint-recommended"
]
},
"dependencies": {
"remark-cli": "^6.0.1",
"remark-lint": "^6.0.2",
@ -9,13 +20,7 @@
"textlint-rule-footnote-order": "^1.0.3",
"textlint-rule-no-empty-section": "^1.1.0"
},
"scripts": {
"textlint": "textlint docs/",
"lint": "remark ."
},
"remarkConfig": {
"plugins": [
"remark-preset-lint-recommended"
]
"devDependencies": {
"gh-pages": "^3.2.3"
}
}

39
scripts/deploy.js Executable file
View File

@ -0,0 +1,39 @@
const { promisify } = require('util')
const { publish } = require('gh-pages')
const ghpublish = promisify(publish)
/* fix for "Unhandled promise rejections" */
process.on('unhandledRejection', err => { throw err })
const Args = process.argv.slice(2)
const USE_HTTPS = Args[0] && Args[0].toUpperCase() === 'HTTPS'
const branch = 'gh-pages'
const org = 'status-im'
const repo = 'specs'
/* use SSH auth by default */
let repoUrl = USE_HTTPS
? `https://github.com/${org}/${repo}.git`
: `git@github.com:${org}/${repo}.git`
/* alternative auth using GitHub user and API token */
if (process.env.GH_USER != undefined) {
repoUrl = (
'https://' + process.env.GH_USER +
':' + process.env.GH_TOKEN +
'@' + `github.com/${org}/${repo}.git`
)
}
const main = async (url, branch)=> {
console.log(`Pushing to: ${url}`)
console.log(`On branch: ${branch}`)
await ghpublish('_site', {
repo: url,
branch: branch,
dotfiles: true,
silent: false
})
}
main(repoUrl, branch)

3047
yarn.lock Normal file

File diff suppressed because it is too large Load Diff