From fcd96f520c2af6821aa413cb1aa1681ea2538d38 Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Fri, 12 Jun 2020 11:06:42 +0200 Subject: [PATCH] [ci] Deploy web site to netlify via cli. --- netlify.toml | 35 ----------------------------------- scripts/ci/jobs/web.yml | 19 ++++++++++++++++++- scripts/docker/Dockerfile.web | 1 + web/public/_redirects | 1 + 4 files changed, 20 insertions(+), 36 deletions(-) delete mode 100644 netlify.toml diff --git a/netlify.toml b/netlify.toml deleted file mode 100644 index 9f913ba3b0c..00000000000 --- a/netlify.toml +++ /dev/null @@ -1,35 +0,0 @@ -[build] - base = "web" - publish = "web/public" - command = """ - git lfs install - git lfs pull - yarn --ignore-engines --ignore-optional --non-interactive - hugo - node_modules/.bin/hugo-algolia --toml -s""" - -[build.environment] # global variables - HUGO_VERSION = "0.64.1" - GIT_LFS_ENABLED = "true" - -[context.production.environment] - HUGO_ENV = "production" - HUGO_ENABLEGITINFO = "true" - -[context.deploy-preview] - command = """ - git lfs install - git lfs pull - yarn --ignore-engines --ignore-optional --non-interactive - hugo -b $DEPLOY_PRIME_URL""" - -[context.branch-deploy] - command = """ - git lfs install - git lfs pull - yarn --ignore-engines --ignore-optional --non-interactive - hugo -b $DEPLOY_PRIME_URL""" - -[[redirects]] - from = "/papers" - to = "https://www.ufz.de/index.php?en=37204" diff --git a/scripts/ci/jobs/web.yml b/scripts/ci/jobs/web.yml index 8746fd92b22..1c49c828884 100644 --- a/scripts/ci/jobs/web.yml +++ b/scripts/ci/jobs/web.yml @@ -15,7 +15,7 @@ web url checker: --white-listed-urls https://jenkins.opengeosys.org/job/ufz/job/ogs-container-maker/job/master/build,http://yourproxy.example.com,https://apt.kitware.com/ubuntu/,https://github.com/YOUR-USERNAME/ogs,https://jenkins.opengeosys.org/github-webhook/,http://localhost:1313,https://github.com/ufz/ogs/pull/\$1,http://www.opengeosys.org/images/xsd/OpenGeoSysXXX.xsd,https://\`-protocol content -build web site: +preview web site: stage: build image: $WEB_IMAGE script: @@ -25,6 +25,7 @@ build web site: - yarn - hugo --environment staging rules: + - if: '$CI_COMMIT_BRANCH != "master"' - changes: - web/ artifacts: @@ -36,3 +37,19 @@ build web site: cache: paths: - web/node_modules + +deploy web site: + stage: package + image: $WEB_IMAGE + script: + - cd web + - yarn + - hugo + - netlify deploy --prod --dir=public + rules: + - if: '$CI_COMMIT_BRANCH == "master"' + - changes: + - web/ + cache: + paths: + - web/node_modules diff --git a/scripts/docker/Dockerfile.web b/scripts/docker/Dockerfile.web index 3d2e7ddec6c..e0fb5d9889d 100644 --- a/scripts/docker/Dockerfile.web +++ b/scripts/docker/Dockerfile.web @@ -8,6 +8,7 @@ RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \ && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y yarn \ && rm -rf /var/lib/apt/lists/* +RUN yarn global add netlify-cli ENV HUGO_VERSION=0.72.0 RUN curl -fSL -O "https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_Linux-64bit.deb" \ && DEBIAN_FRONTEND=noninteractive apt-get install -y /hugo_extended_${HUGO_VERSION}_Linux-64bit.deb \ diff --git a/web/public/_redirects b/web/public/_redirects index 731fe258e52..0931e46ac78 100644 --- a/web/public/_redirects +++ b/web/public/_redirects @@ -13,3 +13,4 @@ /help/documentation/* https://ogs5-keywords.netlify.com /project/license https://gitlab.opengeosys.org/ogs/ogs/-/blob/master/LICENSE.txt +/papers https://www.ufz.de/index.php?en=37204 -- GitLab