Commit 964f83ef authored by Bertrand Gauthier's avatar Bertrand Gauthier Committed by Jean-Philippe Metivier
Browse files

.gitlab-ci.yml : job de création de release + suppression de choses inutilisées

parent d798c470
Loading
Loading
Loading
Loading
+14 −71
Changes for .gitlab-ci.yml: 14 added lines, 71 removed lines.
Original line number Diff line number Diff line
image: localhost:5000/unicaen-dev-php7.0-apache
image: localhost:5000/unicaen-dev-php7.3-apache

stages:
  - test
  - build
  - deploy

before_script:
  ##
  ## Install ssh-agent if not already installed, it is required by Docker.
  ## (change apt-get to yum if you use an RPM-based image)
  ##
  - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'

  ##
  ## Run ssh-agent (inside the build environment)
  ##
  - eval $(ssh-agent -s)

  ##
  ## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
  ## We're using tr to fix line endings which makes ed25519 keys work
  ## without extra base64 encoding.
  ## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
  ##
  - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null

  ##
  ## Create the SSH directory and give it the right permissions
  ##
  - mkdir -p ~/.ssh
  - chmod 700 ~/.ssh

  ##
  ## Optionally, if you will be using any Git commands, set the user name and
  ## and email.
  ##
  #- git config --global user.email "user@example.com"
  #- git config --global user.name "User name"
   
test:
  stage: test
  script: echo "Running tests"
  only:
  - master

build:
  stage: build
  script: echo "Building the app"
  only:
  - master

deploy_preprod:
  stage: deploy
  script:
    - echo "Host usygalpp1.unr-runn.fr" > ~/.ssh/config
    - echo "  ProxyCommand ssh -4 -W %h:%p gauthieb@ssh.unr-runn.fr 2> /dev/null" >> ~/.ssh/config
    - git push root@usygalpp1.unr-runn.fr:/var/www/sygal.git master
  when: manual
  only:
  - master

deploy_prod:
  stage: deploy
  script:
    - echo "Deploy to production server"
  environment:
    name: production
    url: https://example.com
  when: manual
  only:
  - master
  - release

release_job:
  stage: release
  image: registry.gitlab.com/gitlab-org/release-cli:latest
  rules:
    - if: $CI_COMMIT_TAG  # Run this job when a tag is created manually
  script: echo "Creation de la release $CI_COMMIT_TAG..."
  release:
    name: '$CI_COMMIT_TAG'
    tag_name: '$CI_COMMIT_TAG'
    ref: '$CI_COMMIT_TAG'
    description: 'Cf. [CHANGELOG](CHANGELOG.md) et [Release notes](doc/release-notes/v$CI_COMMIT_TAG.md)'