add CI setup for auto deployments
Changes: * Add `Jenkinsfile` for running in CI * Install `gh-pages` and `promisify` Node packages * Add `scripts/deploy.js` that uses `gh-pages` * Update `README` with new links and comments * Drop `package-lock.json` in favour of `yarn.lock` * Added `resources/public/CNAME` set to `simpledapp.status.im` Signed-off-by: Jakub Sokołowski <jakub@status.im>
This commit is contained in:
parent
f1ccdd78d0
commit
ef89c3c2f6
|
@ -0,0 +1,54 @@
|
||||||
|
pipeline {
|
||||||
|
agent { label 'linux' }
|
||||||
|
|
||||||
|
options {
|
||||||
|
disableConcurrentBuilds()
|
||||||
|
/* manage how many builds we keep */
|
||||||
|
buildDiscarder(logRotator(
|
||||||
|
numToKeepStr: '20',
|
||||||
|
daysToKeepStr: '30',
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
environment {
|
||||||
|
SCP_OPTS = 'StrictHostKeyChecking=no'
|
||||||
|
GH_USER = 'status-im-auto'
|
||||||
|
GH_MAIL = 'auto@status.im'
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Git Prep') {
|
||||||
|
steps {
|
||||||
|
sh "git config user.name ${env.GH_USER}"
|
||||||
|
sh "git config user.email ${env.GH_MAIL}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Install Deps') {
|
||||||
|
steps {
|
||||||
|
sh 'yarn install --ignore-optional'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Compile') {
|
||||||
|
steps {
|
||||||
|
sh 'yarn run compile'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Build') {
|
||||||
|
steps {
|
||||||
|
sh 'yarn run build'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stage('Deploy') {
|
||||||
|
steps {
|
||||||
|
sshagent(credentials: ['status-im-auto-ssh']) {
|
||||||
|
sh 'yarn run deploy'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
post {
|
||||||
|
always {
|
||||||
|
sh 'yarn run clean'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
23
README.md
23
README.md
|
@ -1,12 +1,12 @@
|
||||||
# status-dapp
|
# Desription
|
||||||
|
|
||||||
Simple Dapp
|
Status Simple Dapp is a helper Dapp for developers and testers of Status App.
|
||||||
|
|
||||||
### Installation:
|
### Installation:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install
|
yarn install
|
||||||
npm run build
|
yarn run build
|
||||||
```
|
```
|
||||||
|
|
||||||
## Development Mode
|
## Development Mode
|
||||||
|
@ -26,7 +26,7 @@ Wait a bit, then browse to [http://localhost:3449](http://localhost:3449).
|
||||||
### Build CLJS:
|
### Build CLJS:
|
||||||
|
|
||||||
```
|
```
|
||||||
lein build-prod
|
yarn run compile
|
||||||
```
|
```
|
||||||
|
|
||||||
Open `resources/public/index.html` in the browser.
|
Open `resources/public/index.html` in the browser.
|
||||||
|
@ -34,6 +34,15 @@ Open `resources/public/index.html` in the browser.
|
||||||
### Deploy
|
### Deploy
|
||||||
|
|
||||||
```
|
```
|
||||||
lein build-prod
|
yarn run deploy
|
||||||
cp resources/public/js/compiled/app.js ../status-im.github.io/src/dapp/js/compiled/app.js
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Continuous Integration
|
||||||
|
|
||||||
|
Status Jenkins instance builds the `master` branch with this job:
|
||||||
|
|
||||||
|
https://ci.status.im/job/misc/job/simpledapp.status.im/
|
||||||
|
|
||||||
|
Which deploys it to `gh-pages` branch which is published at:
|
||||||
|
|
||||||
|
* https://simpledapp.status.im/
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,11 +1,14 @@
|
||||||
{
|
{
|
||||||
"name": "status-dapp",
|
"name": "simple-dapp",
|
||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"homepage": "https://github.com/status-im/simple-dapp",
|
"homepage": "https://github.com/status-im/simple-dapp",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"watch": "webpack -d --watch",
|
"watch": "webpack -d --watch",
|
||||||
"build": "webpack -p"
|
"compile": "lein build-prod",
|
||||||
|
"build": "webpack -p",
|
||||||
|
"deploy": "node scripts/deploy.js",
|
||||||
|
"clean": "git clean -fxd public"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"react": "^16.2.0",
|
"react": "^16.2.0",
|
||||||
|
@ -13,6 +16,8 @@
|
||||||
"react-native-web": "^0.3.0-rc.4"
|
"react-native-web": "^0.3.0-rc.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"gh-pages": "^2.2.0",
|
||||||
|
"promisify": "^0.0.3",
|
||||||
"webpack": "^3.10.0"
|
"webpack": "^3.10.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
simpledapp.status.im
|
|
@ -0,0 +1,34 @@
|
||||||
|
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 branch = 'gh-pages'
|
||||||
|
const org = 'status-im'
|
||||||
|
const repo = 'simple-dapp'
|
||||||
|
/* use SSH auth by default */
|
||||||
|
var repoUrl = `git@github.com:${org}/${repo}.git`
|
||||||
|
|
||||||
|
/* alternative auth using GitHub user and API token */
|
||||||
|
if (process.env.GH_TOKEN != 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('resources/public', {
|
||||||
|
repo: url,
|
||||||
|
branch: branch,
|
||||||
|
dotfiles: true,
|
||||||
|
silent: false
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
main(repoUrl, branch)
|
Loading…
Reference in New Issue