From fd31ecf7a65ef885aebcc58e756c67e87cc13c49 Mon Sep 17 00:00:00 2001 From: Bastien Abadie <bastien@nextcairn.com> Date: Tue, 26 Nov 2019 21:25:44 +0000 Subject: [PATCH] Surge support --- .gitlab-ci.yml | 16 ++++++++++++++++ webpack.config.js | 3 ++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1b564bb3b..dabbed2a1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -2,6 +2,7 @@ image: node:12-alpine stages: - test - build + - deploy before_script: - npm ci @@ -34,3 +35,18 @@ frontend-build: variables: API_BASE_URL: /api/v1 + +deploy-surge: + stage: deploy + + # Do not deploy master ! + except: + refs: + - master + + before_script: + - npm install -g surge + + script: + - SLUG=$(echo ${CI_BUILD_REF_NAME} | sed 's/[^a-zA-Z0-9\-_]/-/g ; s/-\+/-/g') + - surge dist ${SLUG}-teklia.surge.sh diff --git a/webpack.config.js b/webpack.config.js index aeb11a066..1cea365f5 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -12,6 +12,7 @@ const CompressionPlugin = require('compression-webpack-plugin'); const env = process.env.NODE_ENV || 'development'; const devMode = env === 'development'; const { version } = require('./package.json'); +const API_BASE_URL = process.env.API_BASE_URL || '/api/v1'; const config = { entry: path.join(__dirname, 'js', 'index.js'), @@ -143,7 +144,7 @@ const config = { }, }), new webpack.EnvironmentPlugin({ - API_BASE_URL: devMode ? 'http://localhost:8000/api/v1' : '/api/v1', + API_BASE_URL: devMode ? 'http://localhost:8000/api/v1' : API_BASE_URL, CSRF_COOKIE_NAME: 'arkindex.csrf', VERSION: version, }), -- GitLab