Skip to content

Commit 640798f

Browse files
committed
build: add jenkinsfile and flake file
To be able to deploy site we need a pipeline to build it and publish it to a branch from which our caddy-git service will pull for changes. All of this will be done using nix flake to ease out the build/development process. Referenced issue: #1 Signed-off-by: markoburcul <marko@status.im>
1 parent c0b90eb commit 640798f

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed

Jenkinsfile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#!/usr/bin/env groovy
2+
library 'status-jenkins-lib@v1.9.13'
3+
4+
pipeline {
5+
agent { label 'linux' }
6+
7+
options {
8+
disableConcurrentBuilds()
9+
/* manage how many builds we keep */
10+
buildDiscarder(logRotator(
11+
numToKeepStr: '20',
12+
daysToKeepStr: '30',
13+
))
14+
}
15+
16+
environment {
17+
GIT_COMMITTER_NAME = 'status-im-auto'
18+
GIT_COMMITTER_EMAIL = 'auto@status.im'
19+
}
20+
21+
stages {
22+
stage('Install') {
23+
steps {
24+
script {
25+
nix.develop('yarn install')
26+
}
27+
}
28+
}
29+
30+
stage('Build') {
31+
steps {
32+
script {
33+
nix.develop('yarn build')
34+
jenkins.genBuildMetaJSON('build/build.json')
35+
}
36+
}
37+
}
38+
39+
stage('Publish') {
40+
steps {
41+
sshagent(credentials: ['status-im-auto-ssh']) {
42+
script {
43+
nix.develop("""
44+
ghp-import \
45+
-b deploy-master \
46+
-c docs.status.network \
47+
-p build
48+
""",
49+
pure: false
50+
)
51+
}
52+
}
53+
}
54+
}
55+
}
56+
57+
post {
58+
cleanup { cleanWs() }
59+
}
60+
}

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ Welcome to the official documentation for Status Network! This repository contai
1010
- [Yarn](https://yarnpkg.com/) (v1 or higher)
1111
- [Git](https://git-scm.com/)
1212

13+
If you are familiar with using [Nix shell](https://nix.dev/manual/nix/2.17/command-ref/new-cli/nix3-develop) all of the dependencies will be installed by just running `nix develop` from within this repository which will spawn a new shell.
14+
1315
### Installation
1416

1517
```bash
@@ -40,6 +42,14 @@ yarn build
4042
This command generates static content into the `build` directory and can be served using any static contents hosting service.
4143

4244

45+
## CI/CD
46+
47+
- [CI builds](https://ci.infra.status.im/job/website/job/docs.status.network/) `master` and pushes to `deploy-master` branch, which is hosted at <https://docs.status.network/>.
48+
49+
The hosting is done using [Caddy server with Git plugin for handling GitHub webhooks](https://github.com/status-im/infra-misc/blob/master/ansible/roles/caddy-git).
50+
51+
Information about deployed build can be also found in `/build.json` available on the website.
52+
4353
## 📝 Contributing
4454

4555
We welcome contributions from the community! Here's how you can help improve our documentation:

flake.lock

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
inputs = {
3+
nixpkgs.url = "nixpkgs/nixos-24.05";
4+
};
5+
6+
outputs =
7+
{ self, nixpkgs }:
8+
let
9+
supportedSystems = [
10+
"x86_64-linux"
11+
"aarch64-linux"
12+
"x86_64-darwin"
13+
"aarch64-darwin"
14+
];
15+
forEachSystem = nixpkgs.lib.genAttrs supportedSystems;
16+
pkgsFor = forEachSystem (system: import nixpkgs { inherit system; });
17+
in
18+
rec {
19+
formatter = forEachSystem (system: pkgsFor.${system}.nixpkgs-fmt);
20+
21+
devShells = forEachSystem (system: {
22+
default = pkgsFor.${system}.mkShellNoCC {
23+
packages = with pkgsFor.${system}.buildPackages; [
24+
yarn # 1.22.22
25+
git # 2.44.1
26+
openssh # 9.7p1
27+
nodejs_20 # v20.15.1
28+
ghp-import # 2.1.0
29+
];
30+
};
31+
});
32+
};
33+
}

0 commit comments

Comments
 (0)