Skip to content
Snippets Groups Projects
Commit b52955ef authored by Ulf Seltmann's avatar Ulf Seltmann
Browse files

updated build-process

parent c9529bda
Branches
Tags
No related merge requests found
Pipeline #443 passed with stages
in 1 minute and 48 seconds
stages: stages:
- build - prepare
- test - test
- build
- publish - publish
- image
- docs - docs
- mirror - mirror
variables:
npm_config_cache: ${CI_PROJECT_DIR}/.npm
npm_install: npm_install:
stage: build stage: prepare
image: image:
name: node:8-alpine name: node:8-alpine
entrypoint: ["/bin/su", "node", "-c"] entrypoint: ["/bin/su", "node", "-c"]
script: script:
- test -d .npm && mv .npm ${HOME}
- npm run build - npm run build
- mv ${HOME}/.npm .
cache: cache:
key: "${CI_PROJECT_ID}" key: "${CI_PROJECT_ID}"
paths: paths:
...@@ -42,18 +43,37 @@ npm_ci: ...@@ -42,18 +43,37 @@ npm_ci:
tags: tags:
- docker - docker
npm_publish: npm_pack:
stage: publish stage: build
image: image:
name: node:8-alpine name: node:8-alpine
entrypoint: ["/bin/su", "node", "-c"] entrypoint: ["/bin/su", "node", "-c"]
script: script:
- 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc' - 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
- npm publish --access public - npm pack
cache: cache:
key: "${CI_PROJECT_ID}" key: "${CI_PROJECT_ID}"
paths: paths:
- .npm - .npm
artifacts:
name: npm-pack
paths:
- '*.tgz'
tags:
- docker
docker_build:
stage: build
image: docker:latest
services:
- docker:dind
script: |
docker build --pull -t image .
docker save --output=image.tar.gz image
artifacts:
name: docker-image
paths:
- image.tar.gz
tags: tags:
- docker - docker
except: except:
...@@ -61,8 +81,25 @@ npm_publish: ...@@ -61,8 +81,25 @@ npm_publish:
only: only:
- /^release\/*/ - /^release\/*/
docker_build: npm_publish:
stage: image stage: publish
image:
name: node:8-alpine
entrypoint: ["/bin/su", "node", "-c"]
script:
- 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc'
- npm publish *.tgz --access public
dependencies:
- npm_pack
tags:
- docker
except:
- branches
only:
- /^release\/*/
docker_publish:
stage: publish
image: docker:latest image: docker:latest
services: services:
- docker:dind - docker:dind
...@@ -72,7 +109,8 @@ docker_build: ...@@ -72,7 +109,8 @@ docker_build:
export major_version=`expr ${version} ':' '\([^.]\+\)'` export major_version=`expr ${version} ':' '\([^.]\+\)'`
export minor_version=`expr ${version} ':' '[^.]\+\.\([^.]\+\)'` export minor_version=`expr ${version} ':' '[^.]\+\.\([^.]\+\)'`
export patch_version=`expr ${version} ':' '[^.]\+\.[^.]\+\.\(.\+\)'` export patch_version=`expr ${version} ':' '[^.]\+\.[^.]\+\.\(.\+\)'`
docker build --pull -t ubleipzig/dacap:${version} . docker load --input=image.tar.gz
docker tag image ubleipzig/dacap:${version}
docker push ubleipzig/dacap:${version} docker push ubleipzig/dacap:${version}
for tag in "latest" "${major_version}" "${major_version}.${minor_version}"; do for tag in "latest" "${major_version}" "${major_version}.${minor_version}"; do
docker tag ubleipzig/dacap:${version} ubleipzig/dacap:${tag} docker tag ubleipzig/dacap:${version} ubleipzig/dacap:${tag}
......
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