From a9eb2d50ef6a6dd5bff583940c0be94aa97906db Mon Sep 17 00:00:00 2001 From: Josepablo Cruz Date: Thu, 15 Feb 2024 20:15:16 -0600 Subject: [PATCH] feat(CI): Adding CI pipeline --- .gitlab-ci.yml | 24 ++++++++++++++++++++++++ dotenv | 1 + htaccess | 6 ++++++ scripts/ci_functions.sh | 15 +++++++++++++++ src/views/LoginView.vue | 4 ++-- 5 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 dotenv create mode 100644 htaccess create mode 100644 scripts/ci_functions.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..64d97b3 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,24 @@ +stages: + - build + +variables: + PIPELINE_WORK_DIR: "./" + DOCKERFILE_PATH: "./" + BUILD_NAME: "enruta_web_dashboard" + CONTAINER_NAME: "enruta-web_dashboard" + VITE_API_URL: "https://api.etaviaporte.com/api" + PUBLIC_PORT: 8000 + PRIVATE_PORT: 8000 + +build-job: + stage: build + script: + - . ./scripts/ci_functions.sh + - build_static + artifacts: + paths: + - $PIPELINE_WORK_DIR/$BUILD_NAME.zip + expire_in: 1 week + only: + - master + diff --git a/dotenv b/dotenv new file mode 100644 index 0000000..b2485dc --- /dev/null +++ b/dotenv @@ -0,0 +1 @@ +VITE_API_URL="https://api.etaviaporte.com/api" \ No newline at end of file diff --git a/htaccess b/htaccess new file mode 100644 index 0000000..111280b --- /dev/null +++ b/htaccess @@ -0,0 +1,6 @@ +Options -MultiViews +RewriteEngine On +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule ^ index.html [QSA,L] +RewriteCond %{HTTPS} off +RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] diff --git a/scripts/ci_functions.sh b/scripts/ci_functions.sh new file mode 100644 index 0000000..4c6442c --- /dev/null +++ b/scripts/ci_functions.sh @@ -0,0 +1,15 @@ +#! /bin/bash + +# Requirements +# Node v18 +function build_static(){ + #Global ENV VAR: BUILD_NAME + #Global ENV VAR: VITE_API_URL + nvm use 18 + npm install --force 2>/dev/null + set -x + npm run build 2>/dev/null + cp htaccess dist/.htaccess + zip -r $BUILD_NAME.zip dist/ + set +x +} diff --git a/src/views/LoginView.vue b/src/views/LoginView.vue index 6041d74..db0fb21 100644 --- a/src/views/LoginView.vue +++ b/src/views/LoginView.vue @@ -9,8 +9,8 @@ import { useAuthStore } from '../stores/auth'; const form = reactive({ - email: 'alexandrous.dev@gmail.com', - password: 'Password0', + email: '', + password: '', }); const router = useRouter();