diff --git a/.github/prepare-release b/.github/prepare-release new file mode 100755 index 00000000..b2809391 --- /dev/null +++ b/.github/prepare-release @@ -0,0 +1,24 @@ +#!/bin/sh + +if [ $# -lt 2 ]; +then + echo "usage: $0 " >&2 + echo "" >&2 + echo "release-version : Version of the next release, e.g., 3.1.0" >&2 + echo "new-snapshot-version: Version of the upcoming nightly releases without the -SNAPSHOT suffix, e.g., 3.2.0" >&2 + return 1 +fi + +git switch -C prepare-release/$1 || exit 1 + +set_version_and_commit() { + ./mvnw versions:set -DnewVersion=$1 -DgenerateBackupPoms=false || return 1 + + git add pom.xml || return 1 + git add "**/pom.xml" 2> /dev/null + + git commit -m "$2" || return 1 +} + +set_version_and_commit "$1" "[Release] Version $1" +set_version_and_commit "$2-SNAPSHOT" "[Release] Update version to $2-SNAPSHOT" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..45d5e9f7 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,73 @@ +name: Release + +# workflow triggers +on: + # manually + workflow_dispatch: + # releases + release: + types: [published] + +jobs: + verify: + name: Verify build on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + + steps: + - name: Checkout repository + uses: actions/checkout@v4.2.2 + + - name: Setup Java and Maven cache + uses: actions/setup-java@v4.5.0 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true + cache: 'maven' + + - name: Verify build + run: > + ./mvnw clean verify + --batch-mode + --update-snapshots + --no-transfer-progress + + release: + name: Release + runs-on: ubuntu-latest + needs: [verify] + strategy: + fail-fast: true + + steps: + - name: Checkout repository + uses: actions/checkout@v4.1.1 + + - name: Setup Java and Maven cache + uses: actions/setup-java@v3.13.0 + with: + distribution: 'temurin' + java-version: '17' + check-latest: true + cache: 'maven' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + + - name: Deploy to staging and release + run: > + ./mvnw clean deploy -P release + -DskipTests + --batch-mode + --update-snapshots + --no-transfer-progress + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} diff --git a/pom.xml b/pom.xml index b42c5ff6..d28e9a8a 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ tools.vitruv parent - 3.0.0-SNAPSHOT + 3.0.4 @@ -75,19 +75,6 @@ - - - ossrh-snapshots - OSSRH Snapshots - https://oss.sonatype.org/content/repositories/snapshots - - true - - - false - - - emf-compare