Skip to content
Snippets Groups Projects
Commit 62eba2bc authored by Fabio Maschi's avatar Fabio Maschi
Browse files

Upgrade CI/CD infrastructure

parent 4cb82862
No related branches found
No related tags found
No related merge requests found
Pipeline #2598 passed
# 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'
sed -i 's/"homepage": "\/",/"homepage": "\/'$AWS_DEPLOY_PREFIX'",/g' ./package.json
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment