mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-07-22 17:34:33 +00:00
Docs upload
This commit is contained in:
80
Jenkinsfile
vendored
80
Jenkinsfile
vendored
@ -45,7 +45,9 @@ pipeline {
|
||||
stage('Versions') {
|
||||
steps {
|
||||
sh 'cat frontend/package.json | jq --arg BUILD_VERSION "${BUILD_VERSION}" \'.version = $BUILD_VERSION\' | sponge frontend/package.json'
|
||||
sh 'echo -e "\\E[1;36mFrontend Version is:\\E[1;33m $(cat frontend/package.json | jq -r .version)\\E[0m'
|
||||
sh 'cat backend/package.json | jq --arg BUILD_VERSION "${BUILD_VERSION}" \'.version = $BUILD_VERSION\' | sponge backend/package.json'
|
||||
sh 'echo -e "\\E[1;36mBackend Version is:\\E[1;33m $(cat backend/package.json | jq -r .version)\\E[0m'
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -111,6 +113,27 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Docs') {
|
||||
when {
|
||||
not {
|
||||
equals expected: 'UNSTABLE', actual: currentBuild.result
|
||||
}
|
||||
}
|
||||
steps {
|
||||
ansiColor('xterm') {
|
||||
dir(path: 'docs') {
|
||||
sh 'yarn install'
|
||||
sh 'yarn build'
|
||||
}
|
||||
|
||||
dir(path: 'docs/.vuepress/dist') {
|
||||
sh 'tar -czf ../../docs.tgz *'
|
||||
}
|
||||
|
||||
archiveArtifacts(artifacts: 'docs/docs.tgz', allowEmptyArchive: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('MultiArch Build') {
|
||||
when {
|
||||
not {
|
||||
@ -127,6 +150,38 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Docs Deploy') {
|
||||
when {
|
||||
allOf {
|
||||
branch 'master'
|
||||
not {
|
||||
equals expected: 'UNSTABLE', actual: currentBuild.result
|
||||
}
|
||||
}
|
||||
}
|
||||
steps {
|
||||
withCredentials([[$class: 'AmazonWebServicesCredentialsBinding', accessKeyVariable: 'AWS_ACCESS_KEY_ID', credentialsId: 'npm-s3-docs', secretKeyVariable: 'AWS_SECRET_ACCESS_KEY']]) {
|
||||
sh """docker run --rm \\
|
||||
--name \${COMPOSE_PROJECT_NAME}-docs-upload \\
|
||||
-e S3_BUCKET=jc21-npm-site \\
|
||||
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \\
|
||||
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \\
|
||||
-v $(pwd):/app \\
|
||||
-w /app \\
|
||||
jc21/ci-tools \\
|
||||
scripts/upload /app/docs/.vuepress/dist
|
||||
"""
|
||||
|
||||
sh """docker run --rm \\
|
||||
--name \${COMPOSE_PROJECT_NAME}-docs-invalidate \\
|
||||
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \\
|
||||
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \\
|
||||
jc21/ci-tools \\
|
||||
aws cloudfront create-invalidation --distribution-id EYAMDX2I8TPDZ --paths '/*'
|
||||
"""
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('PR Comment') {
|
||||
when {
|
||||
allOf {
|
||||
@ -144,31 +199,6 @@ pipeline {
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('Docs') {
|
||||
when {
|
||||
allOf {
|
||||
not {
|
||||
equals expected: 'UNSTABLE', actual: currentBuild.result
|
||||
}
|
||||
}
|
||||
}
|
||||
steps {
|
||||
ansiColor('xterm') {
|
||||
sh '''docker run --rm \\
|
||||
-v "$(pwd)/docs:/app" \\
|
||||
-w /app \\
|
||||
node:latest \\
|
||||
sh -c "yarn install && yarn build . && rm -rf node_modules && chown -R $(id -u):$(id -g) /app"
|
||||
'''
|
||||
|
||||
dir(path: 'docs/.vuepress/dist') {
|
||||
sh 'tar -czf ../../docs.tgz *'
|
||||
}
|
||||
|
||||
archiveArtifacts(artifacts: 'docs/docs.tgz', allowEmptyArchive: false)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
28
scripts/docs-upload
Executable file
28
scripts/docs-upload
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Note: This script is designed to be run inside CI builds
|
||||
|
||||
CYAN='\E[1;36m'
|
||||
YELLOW='\E[1;33m'
|
||||
BLUE='\E[1;34m'
|
||||
GREEN='\E[1;32m'
|
||||
RESET='\E[0m'
|
||||
|
||||
echo -e "${BLUE}❯ ${CYAN}Uploading docs in: ${YELLOW}$1${RESET}"
|
||||
|
||||
for DIR in $1
|
||||
do
|
||||
PARAM_STRING="--guess-mime-type"
|
||||
if [ "$DIR" == "css" ]; then
|
||||
PARAM_STRING="-m text/css"
|
||||
elif [ "$DIR" == "js" ]; then
|
||||
PARAM_STRING="-m application/javascript"
|
||||
elif [[ "$DIR" == *html ]]; then
|
||||
PARAM_STRING="-m text/html"
|
||||
fi
|
||||
|
||||
s3cmd -v -f -P "$PARAM_STRING" --add-header="Cache-Control:public,max-age=604800" sync "$DIR" "s3://$S3_BUCKET/"
|
||||
rc=$?; if [ $rc != 0 ]; then exit $rc; fi
|
||||
done
|
||||
|
||||
echo -e "${BLUE}❯ ${GREEN}Upload Complete${RESET}"
|
Reference in New Issue
Block a user