.gitlab-ci.yml
variables: SONAR_HOST_URL: https://sonarcloud.io image: $CI_REGISTRY/autowp/runner-base-image stages: - build - deploy - publish build: stage: build cache: key: files: - package-lock.json paths: - node_modules/ script: - hadolint Dockerfile - npm ci || npm cache clear --force && npm ci - npx ng lint - npx stylelint "src/**/*.scss" - sonar-scanner -Dsonar.login=$SONAR_TOKEN - ./node_modules/.bin/ng build --configuration production --no-progress --base-href=/ - npx semantic-release rules: - if: $CI_COMMIT_TAG !~ /^v\d.*/ deploy: stage: deploy script: - npm ci || npm cache clear --force && npm ci - "jq -n --arg release \"$CI_COMMIT_TAG\" '{release: $release}' > src/version.json" - NG_BUILD_OPTIMIZE_CHUNKS=1 ./node_modules/.bin/ng build --configuration production --no-progress --base-href=/ - echo "$DOCKER_PASSWORD" | buildah login -u "$DOCKER_USERNAME" --password-stdin docker.io - echo "$CI_REGISTRY_PASSWORD" | buildah login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY" - buildah pull "$CI_REGISTRY_IMAGE" || true - buildah build -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" . - buildah push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" - sentry-cli releases new "$CI_COMMIT_TAG" || true - git config --global user.email "$GITLAB_USER_EMAIL" - git config --global user.name "$GITLAB_USER_NAME" - git clone -b master https://gitpush:${GITPUSH_TOKEN}@gitlab.pereslegin.ru/autowp/helm.git - cd helm - yq -i '.frontend.image.tag = strenv(CI_COMMIT_TAG)' values.yaml - git add values.yaml - "git commit -m \"feat: Update frontend to $CI_COMMIT_TAG\"" - git push origin master - sentry-cli releases finalize "$CI_COMMIT_TAG" || true - buildah pull "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" - buildah tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" autowp/autowp-frontend:$CI_COMMIT_TAG - buildah push autowp/autowp-frontend:$CI_COMMIT_TAG rules: - if: $CI_COMMIT_TAG =~ /^v\d.*/ environment: name: production url: https://www.wheelsage.org/