Skip to content
Snippets Groups Projects
Commit d26e71cc authored by Martin Hamerník's avatar Martin Hamerník
Browse files

Merge branch '3-add-ci' into 'master'

Resolve "Add CI"

Closes #3

See merge request kypo-crp/frontend-angular/models/kypo2-angular-topology-model!5
parents c5e5da56 19d89555
Branches
Tags
Loading
image: angulardeploy
variables:
LANG: C.UTF-8
LC_ALL: C.UTF-8
stages:
# - unitTests #TODO, Not implemented yet
# - integrationTests #TODO, Not implemented yet
- buildAngular
- deployAngular
before_script:
# Get version.
# Variable CI_COMMIT_TAG is set only when tag was pushed.
- export VERSION=$(if [[ "$CI_COMMIT_TAG" == "" ]]; then echo "GitLab tag is missing!"; else echo $CI_COMMIT_TAG | cut -c 2-; fi)
- echo $VERSION
#TODO, not implemented yet
#unitTests:
# stage: unitTests
# script:
# - ng test --browsers ChromeHeadless
# only:
# - triggers
# - branches
# - tags
#TODO, not implemented yet
#integrationTests:
# stage: integrationTests
# script:
# - ng e2e
# only:
# - triggers
# - branches
# - tags
buildAngular:
stage: buildAngular
script:
- cp $NPMRC_PULL ~/.npmrc
- npm install
- ng build
only:
- triggers
- branches
- tags
editVersionAndDeploy:
stage: deployAngular
script:
- export GIT_SSH_COMMAND='ssh -i ~/.ssh/kyposervicekey'
- ssh -o "StrictHostKeyChecking no" git@gitlab.ics.muni.cz && sleep 1
- git clone git@gitlab.ics.muni.cz:kypo-crp/frontend-angular/models/kypo2-angular-topology-model.git
- cd $CI_PROJECT_NAME
- git config --global user.name "KYPO CI" && git config --global user.email "kyposervice@ics.muni.cz"
# sed -i -e 's/ "version":.*/ "version": "'$VERSION'",/' projects/user-and-group-management/package.json'
# The command above is not a friend with YAML. Run it in a script as a workaround.
- bash /usr/local/changeVersion.sh $VERSION kypo2-angular-topology-model
- git commit -am "Update project package.json version based on GitLab tag. Done by CI" && sleep 1
- git push
- sleep 5
- cp $NPMRC_PULL ~/.npmrc
- 'npm run build-and-pack'
- cp $NPMRC_PUSH ~/.npmrc
- 'cd dist/kypo2-angular-topology-model && npm publish'
only:
- tags
{ {
"name": "kypo2-topology-graph-model", "name": "kypo2-topology-graph-model",
"version": "1.0.0", "version": "1.0.0",
"author": "Martin Hamerník <445720@mail.muni.cz>",
"description": "Common model of graph topology in its latest form (from Python API)",
"repository": {
"type": "git",
"url": "https://gitlab.ics.muni.cz/kypo2/frontend-new/kypo2-angular-topology-model"
},
"homepage": "https://gitlab.ics.muni.cz/kypo2/frontend-new/kypo2-angular-topology-model",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",
...@@ -17,8 +10,7 @@ ...@@ -17,8 +10,7 @@
"e2e": "ng e2e", "e2e": "ng e2e",
"build-library": "ng build --prod kypo2-topology-graph-model", "build-library": "ng build --prod kypo2-topology-graph-model",
"pack": "cd dist/kypo2-topology-graph-model && npm pack", "pack": "cd dist/kypo2-topology-graph-model && npm pack",
"generate-package": "npm install && npm run build-library && npm run pack", "build-and-pack": "npm install && npm run build-library && npm run pack"
"publish": "npm run generate-package && cd dist/kypo2-topology-graph-model && npm publish --registry=http://kypo-storage.ics.muni.cz:8081/repository/npm-hosted"
}, },
"husky": { "husky": {
"hooks": { "hooks": {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment