.gitlab-ci.yml 988 Bytes
Newer Older
ale's avatar
ale committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
image: docker:latest

stages:
  - build
  - docker_build
  - release

services:
  - docker:dind

variables:
  IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME
  RELEASE_TAG: $CI_REGISTRY_IMAGE:latest
  GIT_SUBMODULE_STRATEGY: recursive

build:
  stage: build
  image: "ai/build:stretch"
  script:
    - ./scripts/lint.sh
    - ./scripts/update.sh
    - tar -c -z -f site.tgz public index templates
  artifacts:
    paths:
      - site.tgz

docker_build:
  stage: docker_build
  script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.git.autistici.org
    - tar -x -z -f site.tgz -C docker
    - docker build --build-arg ci_token=$CI_JOB_TOKEN --pull -t $IMAGE_TAG docker
    - docker push $IMAGE_TAG
  dependencies:
     - build

release:
  stage: release
  script:
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.git.autistici.org
    - docker pull $IMAGE_TAG
    - docker tag $IMAGE_TAG $RELEASE_TAG
    - docker push $RELEASE_TAG
  only:
    - master