rad11
rad11

Reputation: 1561

Gitlab after push tag

Is it possible to configure the gitlab-yml of the project in such a way that after the tag has been pushed out it can run several commands ? If so, how do you get it? I would also like to define the variables that I would like to use in these several commands.

My gitlab-ci looks like:

stages:
  - build
  - deploy

build:
  stage: build
  script:
    - composer install --no-ansi
    - vendor/bin/phar-composer build
  artifacts:
    paths:
      - example.phar
  tags:
    - php:7.0

deploy:
  stage: deploy
  only:
    - tags
  dependencies:
    - build
  script:
    - cp example.phar /opt/example/
  tags:
    - php:7.0

It's about running example.phar bin/console command1 $VARIABLE1 $VARIABLE2 $VARIABLE3 $VARIABLE4.

Please help me because I am not completely familiar with these matters.

Upvotes: 0

Views: 101

Answers (1)

Ekans
Ekans

Reputation: 1067

You can trigger a job when one tag is pushed using only parameter:

build:
  stage: build
  image: alpine:3.6
  script:
  - echo "A tag has been pushed!"
  only:
  - tags

Upvotes: 1

Related Questions