diff --git a/.env b/.env index abd1b9de0957541c09e102d44aa0fcda7159a35d..6e929eb5fa2e2f3be972569ea7251bfd1dc99e9b 100644 --- a/.env +++ b/.env @@ -1 +1,2 @@ -API_CLIENT_URI="https://open.fing.edu.uy/api-preview/v1/graphql" \ No newline at end of file +API_CLIENT_URI="https://open.fing.edu.uy/api-preview/v1/graphql" +PUBLIC_URL=/ \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..f33e1200175036ad379d2d30a2423ebd55438371 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,32 @@ +cache: + paths: + - node_modules/ + +before_script: + - apt-get -qq update + - apt-get -qq install openssh-client git-core gnupg curl > /dev/null + - curl -sSL https://deb.nodesource.com/setup_8.x | bash - + - apt-get -qq install nodejs + +deploy to preview: + stage: deploy + environment: + name: preview + script: + - echo $ENV_PREVIEW_FILE | base64 -d >> ./.env + - set -o allexport; source .env; set +o allexport + + - eval $(ssh-agent -s) + - echo "$SSH_PRIVATE_KEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null + - mkdir -p ~/.ssh + - chmod 700 ~/.ssh + - echo "$PRIVATE_HOST_KEY" | base64 -d > ~/.ssh/known_hosts + + - npm i + - echo "APP_VERSION=$CI_COMMIT_TAG" >> ./.env + - npm run build + + - ssh openfing@openfing.fing.edu.uy 'rm -rf ~/openfing/preview; mkdir ~/openfing/preview' + - scp -r ./build/* openfing@openfing.fing.edu.uy:~/openfing/preview + only: + - /^v\d+\.\d+\.\d+-preview\d+$/