From 60231189a19deb3f52d2171c2db97af611fa45c3 Mon Sep 17 00:00:00 2001
From: Kai Brassel <mail@khbrassel.de>
Date: Sat, 2 Jan 2021 15:14:42 +0100
Subject: [PATCH] Add CI pipeline

---
 .gitlab-ci.yml | 34 ++++++++++++++++++++++++++++++++++
 Dockerfile     |  4 ----
 README.md      |  4 +++-
 3 files changed, 37 insertions(+), 5 deletions(-)
 create mode 100644 .gitlab-ci.yml
 delete mode 100644 Dockerfile

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..0bb7a0d
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,34 @@
+stages:
+  - build
+  - deploy
+
+variables:
+  EXPORT_DIR: "/var/www/html/pages"
+  RELEASE_DIR: "$EXPORT_DIR/$CI_PROJECT_NAME/release_target_100"
+
+build-p2:
+  stage: build
+  tags: 
+    - docker # use shared runner
+  image: maven:3.6.3-adoptopenjdk-15
+  script:
+    - mvn --version
+    - mvn clean install
+  when: manual
+  artifacts:
+    paths:
+      - de.hft-stuttgart.cityunits.p2site/target/repository/
+    expire_in: 1 day
+     
+pages-master:
+  stage: deploy
+  dependencies:
+    - build-p2
+  tags: 
+    - production # use special CLI runner for publishing to $EXPORT_DIR
+  script:
+    - rm -rf "$RELEASE_DIR"
+    - mkdir -p "$RELEASE_DIR"
+    - cp -r de.hft-stuttgart.indriya.p2site/target/repository/* "$RELEASE_DIR"
+  only:
+    - master
diff --git a/Dockerfile b/Dockerfile
deleted file mode 100644
index 9331e4f..0000000
--- a/Dockerfile
+++ /dev/null
@@ -1,4 +0,0 @@
-FROM maven:3.6.3-adoptopenjdk-15
-WORKDIR /home/projects
-COPY ./ ./
-RUN mvn clean install
diff --git a/README.md b/README.md
index d505d25..0d2ae8b 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,5 @@
 # de.hft-stuttgart.cityunits
 
-Create Eclipse P2 repository with Ecore data types for units based on Indriya reference implementation. Provide special units for urban simulation.
\ No newline at end of file
+Create Eclipse P2 repository with Ecore data types for units based on Indriya reference implementation and some special units for urban simulation.
+
+To add OSGi bundles published in this P2 repository add site [https://transfer.hft-stuttgart.de/pages/de.hft-stuttgart.cityunits/release_target_100/]() to a running Eclipse instance via `Eclipse -> Preferences -> Install/Update -> Available Software Sites -> Add...` or to a target platform definition via `Eclipse -> Preferences -> Plug-in Development -> Target Platform -> Edit...`.
\ No newline at end of file
-- 
GitLab