mirror of
https://github.com/logos-co/logos-web.git
synced 2026-08-27 12:11:14 +00:00
* fix(web): build through turbo instead of rebuilding shared deps The app build re-ran the logos-ui build, whose `tsup --clean` wiped packages/ui/dist while logos-crm compiled against it in parallel. The deploy now runs the same turbo build as CI, so only the ui task writes that dist. `out/**` joins the build outputs since turbo owns the export now. * docs(web): build the app through turbo * fix(web): build on Vercel through turbo Vercel ran the app build directly, which no longer builds @acid-info/logos-ui and failed to resolve it. vercel.json pins the deploy to the same turbo command Jenkins runs.
136 lines
3.9 KiB
Groovy
136 lines
3.9 KiB
Groovy
#!/usr/bin/env groovy
|
|
library 'status-jenkins-lib@v1.9.24'
|
|
|
|
pipeline {
|
|
|
|
agent {
|
|
docker {
|
|
label 'linuxcontainer'
|
|
image 'harbor.status.im/infra/ci-build-containers:linux-base-1.0.0'
|
|
args '--volume=/nix:/nix ' +
|
|
'--volume=/etc/nix:/etc/nix ' +
|
|
'--volume=/var/run/docker.sock:/var/run/docker.sock ' +
|
|
'--user jenkins'
|
|
}
|
|
}
|
|
|
|
options {
|
|
disableConcurrentBuilds()
|
|
buildDiscarder(logRotator(
|
|
numToKeepStr: '20',
|
|
daysToKeepStr: '30',
|
|
))
|
|
}
|
|
|
|
environment {
|
|
GIT_COMMITTER_NAME = 'status-im-auto'
|
|
GIT_COMMITTER_EMAIL = 'auto@status.im'
|
|
}
|
|
|
|
parameters {
|
|
string(
|
|
name: 'NEXT_PUBLIC_HCAPTCHA_SITEKEY',
|
|
defaultValue: '2ec82f0e-5f3c-45d2-ba38-223ceb5eee42',
|
|
description: 'Public hCaptcha site key for the apps/web hCaptcha widget.',
|
|
)
|
|
string(
|
|
name: 'DOCKER_CRED',
|
|
description: 'Name of Docker Registry credential.',
|
|
defaultValue: params.DOCKER_CRED ?: 'harbor-logos-web-robot',
|
|
)
|
|
string(
|
|
name: 'DOCKER_REGISTRY_URL',
|
|
description: 'URL of the Docker Registry',
|
|
defaultValue: params.DOCKER_REGISTRY_URL ?: 'https://harbor.status.im',
|
|
)
|
|
string(
|
|
name: 'IMAGE_TAG',
|
|
description: 'Image tag',
|
|
defaultValue: params.IMAGE_TAG ?: deployBranch(),
|
|
)
|
|
string(
|
|
name: 'IMAGE_NAME',
|
|
description: 'Name of the Docker image',
|
|
defaultValue: 'logos-web/logos-cms',
|
|
)
|
|
}
|
|
|
|
stages {
|
|
|
|
stage('Build the web app') {
|
|
steps {
|
|
script {
|
|
withEnv([
|
|
"NEXT_PUBLIC_SITE_URL=https://${deployDomain()}",
|
|
"NEXT_PUBLIC_CIVI_CRM_URL=${civiCrmUrl()}",
|
|
"NEXT_PUBLIC_HCAPTCHA_SITEKEY=${params.NEXT_PUBLIC_HCAPTCHA_SITEKEY}",
|
|
"NEXT_PUBLIC_API_MODE=${apiMode()}",
|
|
]) {
|
|
nix.develop('pnpm turbo run build --filter=web',
|
|
keepEnv: [
|
|
'NEXT_PUBLIC_SITE_URL',
|
|
'NEXT_PUBLIC_CIVI_CRM_URL',
|
|
'NEXT_PUBLIC_HCAPTCHA_SITEKEY',
|
|
'NEXT_PUBLIC_API_MODE'
|
|
]
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Publish web app') {
|
|
steps {
|
|
sshagent(credentials: ['status-im-auto-ssh']) {
|
|
script {
|
|
nix.develop("""
|
|
ghp-import \
|
|
-b ${deployBranch()} \
|
|
-c ${deployDomain()} \
|
|
-p apps/web/out
|
|
""", sandbox: false,
|
|
keepEnv: ['SSH_AUTH_SOCK'])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Build CMS docker image') {
|
|
steps {
|
|
script {
|
|
withCredentials([string(credentialsId: 'logos-cms-actions-encryption-key', variable: 'NEXT_SERVER_ACTIONS_ENCRYPTION_KEY')]) {
|
|
image = docker.build(
|
|
"${params.IMAGE_NAME}:${params.IMAGE_TAG}",
|
|
"--build-arg NEXT_PUBLIC_SERVER_URL=https://${cmsDomain()} " +
|
|
"--build-arg NEXT_PUBLIC_WEB_URL=https://${deployDomain()} " +
|
|
"--build-arg NEXT_SERVER_ACTIONS_ENCRYPTION_KEY=${NEXT_SERVER_ACTIONS_ENCRYPTION_KEY} " +
|
|
"-f ./apps/cms/Dockerfile ."
|
|
)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
stage('Push CMS docker image'){
|
|
steps {
|
|
script {
|
|
withDockerRegistry([
|
|
credentialsId: params.DOCKER_CRED, url: params.DOCKER_REGISTRY_URL
|
|
]) {
|
|
image.push()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
cleanup { cleanWs() }
|
|
}
|
|
}
|
|
def isMasterBranch() { GIT_BRANCH ==~ /.*master/ }
|
|
def deployBranch() { isMasterBranch() ? 'deploy-master' : 'deploy-develop' }
|
|
def deployDomain() { isMasterBranch() ? 'logos.co' : 'dev.logos.co' }
|
|
def apiMode() { isMasterBranch() ? 'production' : 'staging' }
|
|
def civiCrmUrl() { isMasterBranch() ? 'https://logos-web-civi.vercel.app' : 'https://logos-web-civi-git-develop-status-im-web.vercel.app/' }
|
|
def cmsDomain() { isMasterBranch() ? 'cms.logos.co' : 'dev-cms.logos.co' }
|