Skip to content
.gitlab-ci.yml 1.52 KiB
Newer Older
Pierre Ozoux's avatar
Pierre Ozoux committed
variables:
  GIT_SUBMODULE_STRATEGY: recursive
  DOCKER_HUB_REPO: libresh/discourse

Timothee Gosselin's avatar
Timothee Gosselin committed
.compute_version: &compute_version
  - if [ "$CHANNEL" == "stable" ]; then export FILTER="grep -v beta"; else export FILTER="grep beta"; fi
  - export DISCOURSE_VERSION=`wget -qO- https://api.github.com/repos/discourse/discourse/tags | grep name | cut -d'"' -f4 | $FILTER | head -n1`
Pierre Ozoux's avatar
Pierre Ozoux committed
  - export DATE=`date "+%Y-%m-%dT%H-%M-%SZ"`
Timothee Gosselin's avatar
Timothee Gosselin committed

.test:
Pierre Ozoux's avatar
Pierre Ozoux committed
  image:
    name: gcr.io/kaniko-project/executor:debug
    entrypoint: [""]
Timothee Gosselin's avatar
Timothee Gosselin committed
  variables:
    DESTINATION: "--no-push"
Pierre Ozoux's avatar
Pierre Ozoux committed
  script:
Timothee Gosselin's avatar
Timothee Gosselin committed
    - *compute_version
    - export DISCOURSE_MAJOR=`echo $DISCOURSE_VERSION | cut -d"." -f1-3`
Pierre Ozoux's avatar
Pierre Ozoux committed
    - echo $DISCOURSE_MAJOR
    - echo $DISCOURSE_VERSION
Pierre Ozoux's avatar
Pierre Ozoux committed
    - /kaniko/executor --single-snapshot --context .  ${DESTINATION} --build-arg DISCOURSE_VERSION=$DISCOURSE_VERSION
Pierre Ozoux's avatar
Pierre Ozoux committed
  except:
  - master

Timothee Gosselin's avatar
Timothee Gosselin committed
test-beta:
  extends: .test
  variables:
    CHANNEL: "beta"

Pierre Ozoux's avatar
Pierre Ozoux committed
test-stable:
Timothee Gosselin's avatar
Timothee Gosselin committed
  extends: .test
  variables:
    CHANNEL: "stable"
Timothee Gosselin's avatar
Timothee Gosselin committed
.push:
  extends: .test
  before_script:
Timothee Gosselin's avatar
Timothee Gosselin committed
    - *compute_version
Pierre Ozoux's avatar
Pierre Ozoux committed
    - cp $DOCKER_SECRET_CONFIG /kaniko/.docker/config.json
Timothee Gosselin's avatar
Timothee Gosselin committed
    - export DESTINATION="--destination ${DOCKER_HUB_REPO}:${DISCOURSE_VERSION}-${DATE} --destination ${DOCKER_HUB_REPO}:${DISCOURSE_VERSION} --destination ${DOCKER_HUB_REPO}:${DISCOURSE_MAJOR} --destination ${DOCKER_HUB_REPO}:${CHANNEL}"
  except: []
Pierre Ozoux's avatar
Pierre Ozoux committed
  only:
  - master

Pierre Ozoux's avatar
Pierre Ozoux committed
# bug: the CHANNEL variable is not passed to the Dockerfile. 
Timothee Gosselin's avatar
Timothee Gosselin committed
push-beta:
  extends: .push
  variables:
    CHANNEL: "beta"

Pierre Ozoux's avatar
Pierre Ozoux committed
#push-stable:
#  extends: .push
#  variables:
#    CHANNEL: "stable"