Skip to content
Snippets Groups Projects
Commit f9dd6b64 authored by stevereis's avatar stevereis
Browse files

feat: Add release process in gitlab pipeline

Build and  release a new version along with a new docker image
parent cee1e251
No related branches found
No related tags found
No related merge requests found
image: docker:20
services:
- docker:20-dind
stages:
- build
- release
- deploy
variables:
CONTAINER_BASE_IMAGE: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
services:
- docker:dind
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
build:
image: docker:dind
stage: build
only:
refs:
- main
- develop
- rc
# This matches maintenance branches
- /^(([0-9]+)\.)?([0-9]+)\.x/
# This matches pre-releases
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
script:
- docker build -t $CONTAINER_BASE_IMAGE ./api
- docker push $CONTAINER_BASE_IMAGE
- docker build -t $CI_REGISTRY/$CI_PROJECT_PATH:pipeline-$CI_PIPELINE_ID ./api
- docker push $CI_REGISTRY/$CI_PROJECT_PATH:pipeline-$CI_PIPELINE_ID
release:
image: docker:dind
stage: release
only:
refs:
- main
- develop
- /^release-.*$/
- rc
# This matches maintenance branches
- /^(([0-9]+)\.)?([0-9]+)\.x/
# This matches pre-releases
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
script:
- apk add --no-cache nodejs npm py3-pip python2 git
- docker pull $CI_REGISTRY/$CI_PROJECT_PATH:pipeline-$CI_PIPELINE_ID
- docker tag $CI_REGISTRY/$CI_PROJECT_PATH:pipeline-$CI_PIPELINE_ID gateway-semantic:latest
- cd ./api
- npm install @semantic-release/gitlab @semantic-release/changelog @eclass/semantic-release-docker
- npx semantic-release
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment