Untitled

 avatar
unknown
plain_text
2 years ago
1.1 kB
6
Indexable
image: docker:latest

stages:
  - unittest
  - build
  - test
  - deploy

before_script:
  - echo "Preparing environment..."

unittest:
  stage: unittest
  script: echo "Running unit tests..."
  tags:
    - test

build:
  stage: build
  script: echo "Building the application..."
  needs: 
  - unittest
  - test
  tags:
    - test
  only:
    refs:
      - master
  except:
    changes:
      - "*.md"

deploy:dev:
  stage: deploy
  script: echo "Deploying to dev environment..."
  environment: dev
  tags:
    - test
  hidden: false

deploy:test:
  extends: deploy:dev
  script: echo "Deploying to test environment..."
  tags:
    - test
  only: tags

test:
  stage: test
  script: echo "Testing the application on stand..."
  needs: ["build"]
  tags:
    - test
  when: manual

deploy:prod:
  extends: deploy:test
  stage: deploy
  script: echo "Deploying to production environment..."
  environment: production
  tags:
    - test
  needs:
    - deploy:test
  rules:
    - if: $CI_COMMIT_REF_NAME != $CI_DEFAULT_BRANCH
      variables:
        DEPLOY_VARIABLE: "deploy-production"
Editor is loading...