diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 90cb4ec..44631b7 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -22,20 +22,23 @@ jobs: java-version: '17' distribution: 'adopt' cache: maven - - name: Fail build if version contains SNAPSHOT + - run: echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + - run: echo "BUILD_VERSION=${VERSION%-SNAPSHOT}" >> $GITHUB_ENV + - name: Build with Maven and publish package run: | - VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) + echo $VERSION + echo $BUILD_VERSION if [[ "$VERSION" == *SNAPSHOT ]]; then - echo "Version contains SNAPSHOT, failing the workflow!" - exit 1 + git config --global user.email "info@example.com" + git config --global user.name "Maven Release Plugin" + + mvn -B clean release:prepare release:perform -Prelease -DreleaseVersion=$BUILD_VERSION -Dresume=false -DautoVersionSubmodules=true -DdryRun=false -Dmaven.test.skip=true -DskipITs -DscmCommentPrefix="[maven-release-plugin][ci skip] " -Djdk.net.URLClassPath.disableClassPathURLCheck=true else - echo "Version is valid, continuing with the workflow." + echo "Version is not valid, failing the workflow." + exit 1 fi - - name: Build with Maven and publish package - run: mvn -B -U clean verify install -P release deploy -Djdk.net.URLClassPath.disableClassPathURLCheck=true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - run: echo "RELEASE_VERSION=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> $GITHUB_ENV - run: echo "ARTIFACT_JAR_FILE=$(ls oc-sso-notificatie/target/*.jar | xargs basename)" >> $GITHUB_ENV - run: echo "ARTIFACT_FILE_NAME=$(ls oc-sso-notificatie/target/*.jar | xargs basename | sed 's/\.[^.]*$//')" >> $GITHUB_ENV - run: echo "ARTIFACT_PATH=$(ls oc-sso-notificatie/target/*.jar)" >> $GITHUB_ENV @@ -49,8 +52,8 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: ${{ env.RELEASE_VERSION }} - release_name: Release ${{ env.RELEASE_VERSION }} + tag_name: ${{ env.BUILD_VERSION }} + release_name: Release ${{ env.BUILD_VERSION }} draft: false prerelease: false - name: Upload Release Asset diff --git a/pom.xml b/pom.xml index 72b07e6..bb8e3e5 100644 --- a/pom.xml +++ b/pom.xml @@ -30,6 +30,12 @@ OC SSO Notification OpenConext SSO Notification as a separate Service. + + https://github.com/OpenConext/OpenConext-SSO-Notification + scm:git:https://github.com/OpenConext/OpenConext-SSO-Notification.git + HEAD + + 2021 @@ -62,6 +68,14 @@ ${java.version} + + org.apache.maven.plugins + maven-deploy-plugin + ${maven-deploy-plugin.version} + + true + + org.apache.maven.plugins maven-surefire-plugin @@ -105,9 +119,10 @@ maven-release-plugin ${maven.release.version} + true release true - true + ${BUILD_VERSION} diff --git a/release/pom.xml b/release/pom.xml index bbe7354..8cde951 100644 --- a/release/pom.xml +++ b/release/pom.xml @@ -32,7 +32,6 @@ 2.3.1,2.3.0,2.2.1,2.2.0,2.1.1,2.1.0,2.0.6,2.0.5,2.0.4,2.0.3,2.0.2,2.0.1,1.0.0 - false 2.8 3.8.2 2.4 @@ -104,6 +103,13 @@ + + org.apache.maven.plugins + maven-deploy-plugin + + true + +