diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..9c61abc --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,85 @@ +pipeline { + agent { label 'linux' } + + options { + disableConcurrentBuilds() + /* Necessary for logos-side-builder local_folder source type. */ + checkoutToSubdirectory('src') + /* manage how many builds we keep */ + buildDiscarder(logRotator( + numToKeepStr: '20', + daysToKeepStr: '30', + )) + } + + environment { + /* Mode of logos-site-builder for copying site source from already checked out repo. + * TODO: Avoid copying anything at all, make checkout site of into `docs` folder work. */ + CONTENT_SOURCE_TYPE = 'local_folder' + CONTENT_SOURCE_URL = '../src' + GIT_COMMITTER_NAME = 'status-im-auto' + GIT_COMMITTER_EMAIL = 'auto@status.im' + /* dev page settings */ + DEV_SITE = 'dev-rlnp2p.vac.dev' + DEV_HOST = 'jenkins@node-01.do-ams3.sites.misc.statusim.net' + SCP_OPTS = 'StrictHostKeyChecking=no' + } + + stages { + stage('Clone Builder') { + steps { + dir('builder') { + checkout([$class: 'GitSCM', + branches: [[name: 'v0']], + userRemoteConfigs: [[url: 'https://github.com/acid-info/logos-site-builder']]]) + } + } + } + + stage('Install') { + steps { + dir('builder') { + sh 'yarn install' + } + } + } + + stage('Build') { + steps { + dir('builder') { + sh 'yarn build' + } + } + } + + stage('Publish Prod') { + when { expression { env.GIT_BRANCH ==~ /.*master/ } } + steps { + dir('src') { + sh 'cp -r ../builder/out ./' + sshagent(credentials: ['status-im-auto-ssh']) { + sh "ghp-import -p out" + } + } + } + } + + stage('Publish Devel') { + when { expression { env.GIT_BRANCH ==~ /.*develop/ } } + steps { + dir('builder') { + sshagent(credentials: ['jenkins-ssh']) { + sh """ + rsync -e 'ssh -o ${SCP_OPTS}' -r --delete out/. \ + ${env.DEV_HOST}:/var/www/${env.DEV_SITE}/ + """ + } + } + } + } + } + + post { + cleanup { cleanWs() } + } +} diff --git a/README.md b/README.md index 9f4d06e..f172e9f 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,16 @@ Made and deployed with [logos site-builder](https://github.com/acid-info/logos-site-builder). -# Continuous Deloyment +# Continuous Integration -- `staging` branch is deployed to [staging.rlnp2p.vac.dev](https://staging.rlnp2p.vac.dev) -- `master` branch is deployed to [rlnp2p.vac.dev](https://rlnp2p.vac.dev) +Two branches are built by [our Jenkins instance](https://ci.infra.status.im/): + +* `master` branch is deployed to https://rlnp2p.vac.dev by [CI](https://ci.infra.status.im/job/website/job/rlnp2p.vac.dev/) +* `develop` branch is deployed to https://dev-rlnp2p.vac.dev by [CI](https://ci.infra.status.im/job/website/job/dev-rlnp2p.vac.dev/) # Change Process -1. Create a new working branch from `staging`: `git checkout staging; git checkout -b my-changes`; -2. Proceed with changes, push to `origin` and open a Pull Request against `staging`; -3. Once approved, merge pull request, check changes on [staging.vac.dev](https://staging.vac.dev); -4. Once ready to promote to live website, rebase master on staging: `git checkout master; git pull master; git rebase origin/staging; git push`. +1. Create a new working branch from `develop`: `git checkout develop; git checkout -b my-changes`; +2. Proceed with changes, push to `origin` and open a Pull Request against `develop`; +3. Once approved, merge pull request, check changes on [dev-rlnp2p.vac.dev](https://dev-rlnp2p.vac.dev); +4. Once ready to promote to live website, rebase master on develop: `git checkout master; git pull master; git rebase origin/develop; git push`. diff --git a/static-assets/CNAME b/static-assets/CNAME new file mode 100644 index 0000000..0e6e8fb --- /dev/null +++ b/static-assets/CNAME @@ -0,0 +1 @@ +rlnp2p.vac.dev \ No newline at end of file