diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 127998ea4c..64373e4b4e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -51,6 +51,8 @@ jobs: path: ~/.m2 key: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }}-${{ hashFiles('**/pom.xml') }} restore-keys: ${{ runner.os }}-${{ env.CACHE_MAVEN_NAME }} + - name: Change versions to match tag + run: ci/change_version.sh -m . - name: Compile & build run: ./mvnw -B install -DskipTests -Dasciidoctor.skip -Djacoco.skip - name: Populate cache @@ -205,6 +207,8 @@ jobs: with: name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }} path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }} + - name: Change versions to match tag + run: ci/change_version.sh -m . # Theoretically this step below not necessary because we reuse the cache from the 'compile_frontend' job. # Sometimes the cache is not created, therefore this is a fallback. - name: Populate cache @@ -311,6 +315,10 @@ jobs: with: name: ${{ env.ARTIFACTS_TASKANA_JARS_NAME }} path: ${{ env.ARTIFACTS_TASKANA_JARS_PATH }} + - name: Change versions to match tag + run: | + ci/change_version.sh -m . + ci/update_taskana_dependency_for_wildfly.sh - name: Generate JavaDoc for Rest Documentation if: matrix.module == 'taskana-simplehistory-rest-spring' run: ./mvnw -B validate -pl :taskana-rest-spring @@ -394,7 +402,7 @@ jobs: - name: Update version to next snapshot and push back run: | ci/change_version.sh -i -m . - ci/update_taskana_dependency_for_wildfly.sh + ci/update_taskana_dependency_for_wildfly.sh -i ci/commitPoms.sh rest/taskana-rest-spring-example-wildfly/src/test/java/pro/taskana/example/wildfly/AbstractAccTest.java env: GH_EMAIL: ${{ secrets.GH_EMAIL }} diff --git a/ci/change_version.sh b/ci/change_version.sh index 806396a6f1..dae376a672 100755 --- a/ci/change_version.sh +++ b/ci/change_version.sh @@ -6,7 +6,7 @@ set -e #fail fast #H #H prints this help and exits #H -#H %FILE% <-m modules...> [-i] +#H %FILE% [-i] #H #H if a release version exists (extracted from GITHUB_REF) #H the maven versions of all modules will be changed to the given release version. diff --git a/ci/update_taskana_dependency_for_wildfly.sh b/ci/update_taskana_dependency_for_wildfly.sh index 4f02bb6b38..39a2b8c756 100755 --- a/ci/update_taskana_dependency_for_wildfly.sh +++ b/ci/update_taskana_dependency_for_wildfly.sh @@ -6,11 +6,13 @@ set -e #fail fast #H #H prints this help and exits #H -#H %FILE% +#H %FILE% [-i] #H #H if a release version exists (extracted from GITHUB_REF environment variable) -#H the taskana dependency in our wildfly example project will be incremented to the new version snapshot. +#H the taskana dependency in our wildfly example project will be incremented to the new version. #H +#H i: +#H increments version to next snapshot # Arguments: # $1: exit code function helpAndExit() { @@ -36,12 +38,24 @@ function main() { [[ "$1" == '-h' || "$1" == '--help' ]] && helpAndExit 0 if [[ "$GITHUB_REF" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then REL=$(dirname "$0") + while [[ $# -gt 0 ]]; do + case $1 in + -i) + INCREMENT="true" + shift # passed argument + ;; + *) # unknown option + echo "unknown parameter $1" >&2 + exit 1 + ;; + esac + done FILES=( - "$REL/../rest/taskana-rest-spring-example-wildfly/pom.xml" "$REL/../rest/taskana-rest-spring-example-wildfly/src/test/java/pro/taskana/example/wildfly/AbstractAccTest.java" ) + version=$([[ -n "$INCREMENT" ]] && echo "$(increment_version "${GITHUB_REF##refs/tags/v}")-SNAPSHOT" || echo "${GITHUB_REF##refs/tags/v}") for file in "${FILES[@]}"; do - sed -i "s/[0-9]\+\.[0-9]\+\.[0-9]\+-SNAPSHOT/$(increment_version "${GITHUB_REF##refs/tags/v}")-SNAPSHOT/g" "$file" + sed -i "s/\"[0-9]\+\.[0-9]\+\.[0-9]\+\(-SNAPSHOT\)\?\"/\"${version}\"/g" "$file" done else echo "skipped version change for wildfly because this is not a release build"