diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 17f243504bf1d82050329d09ae1d2a3c1d6af6e1..34361277469fc0337b410ad50b2af5918cf351eb 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 38b134e587febce920a2caa68fb301b5c5818df2..0000000000000000000000000000000000000000 --- a/support/change-homepage.sh +++ /dev/null @@ -1 +0,0 @@ -sed -i 's/"homepage": "\/",/"homepage": "\/'$AWS_DEPLOY_PREFIX'",/g' ./package.json