From 62eba2bc4250b60ee8989ac391e1fa719673bc2d Mon Sep 17 00:00:00 2001 From: Fabio Maschi <fabio@igem.org> Date: Sat, 5 Feb 2022 19:13:40 +0100 Subject: [PATCH] Upgrade CI/CD infrastructure --- .gitlab-ci.yml | 82 ++------------------------------------ support/change-homepage.sh | 1 - 2 files changed, 3 insertions(+), 80 deletions(-) delete mode 100644 support/change-homepage.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 17f2435..3436127 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,79 +1,3 @@ -# node image -image: node:16.13.1-alpine - -# cache dependencies -cache: - - key: - files: - - yarn.lock - paths: - - .yarn-cache/ - - when: 'on_success' - -.build: - stage: build - script: - - echo 'yarn-offline-mirror ".yarn-cache/"' >> .yarnrc - - echo 'yarn-offline-mirror-pruning true' >> .yarnrc - - yarn install --production --frozen-lockfile --no-progress - - chmod +x support/change-homepage.sh - - ./support/change-homepage.sh - - yarn build - - rm ./public -rf - - mv ./build ./public - - cp ./public/index.html ./public/404.html - artifacts: - paths: - - public - -build-prod: - environment: - name: production - extends: .build - rules: - - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH' - when: never - - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' - -build-dev: - environment: - name: development - extends: .build - variables: - AWS_DEPLOY_PREFIX: $CI_PROJECT_NAME - rules: - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - when: never - - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' - -lint: - stage: test - script: - - yarn - - yarn lint - -pages: - stage: deploy - environment: - name: production - script: - - echo "Deploy to GitLab pages"; - artifacts: - paths: - - public - rules: - - if: '$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH' - when: never - - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' - -pages-dev: - stage: deploy - environment: - name: development - image: 'registry.gitlab.com/gitlab-org/cloud-deploy/aws-base:latest' - script: - - aws s3 sync ./public s3://$AWS_FRONTENDS_BUCKET_DEV/$CI_PROJECT_NAME --delete - rules: - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - when: never - - if: '$CI_COMMIT_TAG || $CI_COMMIT_BRANCH' +include: + - project: 'hq-tech/ci-cd-templates' + file: '/websites.gitlab-ci.yml' diff --git a/support/change-homepage.sh b/support/change-homepage.sh deleted file mode 100644 index 38b134e..0000000 --- a/support/change-homepage.sh +++ /dev/null @@ -1 +0,0 @@ -sed -i 's/"homepage": "\/",/"homepage": "\/'$AWS_DEPLOY_PREFIX'",/g' ./package.json -- GitLab