diff --git a/.idea/misc.xml b/.idea/misc.xml
index c187dd8..e436f93 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,7 +4,7 @@
-
+
diff --git a/.woodpecker/.backend.yml b/.woodpecker/.backend.yml
index d3dd9b3..adadc51 100644
--- a/.woodpecker/.backend.yml
+++ b/.woodpecker/.backend.yml
@@ -14,7 +14,7 @@ steps:
image: *java_image
commands:
- gradle spotlessCheck --no-daemon
- "lint:hadolint":
+ "lint:dockerfile":
group: lint
image: ghcr.io/hadolint/hadolint:latest-debian
commands:
@@ -28,5 +28,16 @@ steps:
image: *java_image
commands:
- ./gradlew cyclonedxBom
+
+ "deploy:backend":
+ image: alpine:latest
+ commands:
+ - echo "deploy frontend"
+ - env
+ directory: frontend
+ when:
+ - event: [deployment]
+
+
depends_on:
- "lint_general"
diff --git a/.woodpecker/.frontend.yml b/.woodpecker/.frontend.yml
index c37a03e..ed384f2 100644
--- a/.woodpecker/.frontend.yml
+++ b/.woodpecker/.frontend.yml
@@ -48,5 +48,14 @@ steps:
- npx @cyclonedx/cyclonedx-npm --output-file bom.json
directory: frontend
+ "deploy:frontend":
+ image: alpine:latest
+ commands:
+ - echo "deploy frontend"
+ - env
+ directory: frontend
+ when:
+ - event: [manual]
+
depends_on:
- "lint_general"
diff --git a/.woodpecker/.version-update.yml b/.woodpecker/.version-update.yml
new file mode 100644
index 0000000..04b4d38
--- /dev/null
+++ b/.woodpecker/.version-update.yml
@@ -0,0 +1,24 @@
+---
+when:
+ branch: dev
+clone:
+ git:
+ image: woodpeckerci/plugin-git
+ settings:
+ skip_verify: true
+ partial: true
+
+steps:
+ "version:update":
+ image: bitnami/git:2.42.1
+ commands:
+ - echo "$CI_COMMIT_MESSAGE" | ./version-auto-update.sh
+ - git config --global http.sslVerify false
+ - git remote set-url origin "https://$CI_COMMIT_AUTHOR:$GIT_PAT@$(echo $CI_REPO_CLONE_URL | cut -b9-)"
+ - "git config --global user.name $CI_COMMIT_AUTHOR"
+ - "git config --global user.email $CI_COMMIT_AUTHOR_EMAIL"
+ - "git commit -am \"chore: auto update version [skip ci]\""
+ - "git push origin HEAD:dev"
+ secrets: [git_pat]
+depends_on:
+ - "lint_general"
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..966841b
--- /dev/null
+++ b/README.md
@@ -0,0 +1 @@
+# Demo CI
diff --git a/app/README.md b/app/README.md
new file mode 100644
index 0000000..e69de29
diff --git a/version-auto-update.sh b/version-auto-update.sh
new file mode 100755
index 0000000..0243cc6
--- /dev/null
+++ b/version-auto-update.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+
+read -r msg
+
+if [[ $msg = *"BREAKING CHANGE:"* ]]; then
+ ./update-version.sh MAJOR
+fi
+
+summary=$(echo "$msg" | head -1)
+type=$(cut -d':' -f1 <<< "$summary")
+
+if [[ $type = *"!"* ]]; then
+ ./version-update.sh MAJOR
+fi
+
+if [[ $type = "feat" ]]; then
+ ./version-update.sh MINOR
+else
+ echo "last commit message does not indicate a base version update, skipping"
+fi
diff --git a/version-update.sh b/version-update.sh
new file mode 100755
index 0000000..b3df056
--- /dev/null
+++ b/version-update.sh
@@ -0,0 +1,11 @@
+#!/usr/bin/env bash
+source version.sh
+
+if [ "MINOR" == "$1" ] ; then
+ NEW_VERSION=$(awk -F. '{printf("%s.%s", $1, int($2+1))}' version.txt)
+elif [ "MAJOR" == "$1" ] ; then
+ NEW_VERSION=$(awk -F. '{printf("%s.0", int($1+1))}' version.txt)
+fi
+echo "${NEW_VERSION}"
+
+echo "${NEW_VERSION}" > version.txt
diff --git a/version.sh b/version.sh
new file mode 100755
index 0000000..98c02c9
--- /dev/null
+++ b/version.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+# We only want to tag in git when the version changes
+# Next version is based on versioned version.txt
+# using git describe requires a tag at the begging of development, not at the end
+TRUNK_BRANCH="dev"
+CD_BASE_VERSION=$(cat version.txt)
+CD_PATCH=$(git rev-list --count HEAD ^"${TRUNK_BRANCH}")
+CD_QUALIFIER=$(git rev-parse --short HEAD)
+CD_CURRENT_RELEASE_TAG=$(git tag -l --contains HEAD)
+CD_NEXT_VERSION="${CD_BASE_VERSION}.${CD_PATCH}"
+CD_NEXT_QUALIFIED_VERSION="${CD_BASE_VERSION}.${CD_PATCH}-${CD_QUALIFIER}"
+CD_NEXT_MAJOR_TAG=$(cut -d'.' -f1 <<< "${CD_BASE_VERSION}")
+
+export CD_BASE_VERSION
+export CD_PATCH
+export CD_QUALIFIER
+export CD_RELEASE_TAG
+export CD_NEXT_QUALIFIED_VERSION
+export CD_NEXT_MAJOR_TAG
+
+echo "Example versioning"
+echo "Trunk Branch: ${TRUNK_BRANCH}"
+echo "Java Development Version: ${CD_BASE_VERSION}.0-SNAPSHOT"
+echo "NPM Development Version: ${CD_BASE_VERSION}.alpha.0"
+echo "Next Release Version: ${CD_NEXT_VERSION}"
+echo "Next qualified Release Version: ${CD_NEXT_QUALIFIED_VERSION}"
+echo "BASE TAG: ${CD_BASE_VERSION}"
+echo "Next Major Release Tag: ${CD_NEXT_MAJOR_TAG}"
+echo "Current Release Tag (normally get from pipeline CI_COMMIT_TAG): ${CD_RELEASE_TAG}"
diff --git a/version.txt b/version.txt
new file mode 100644
index 0000000..5a2a580
--- /dev/null
+++ b/version.txt
@@ -0,0 +1 @@
+0.6