diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 46ebf90..00eebb8 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -10,12 +10,12 @@ jobs: runs-on: ubuntu-latest steps: - name: "Checkout Branch" - uses: actions/checkout@v3 - - name: "Install JDK 11" - uses: actions/setup-java@v3 + uses: actions/checkout@v4 + - name: "Install JDK 17" + uses: actions/setup-java@v5 with: distribution: "zulu" - java-version: "11" + java-version: "17" cache: "gradle" - name: "Run Tests" run: ./gradlew test diff --git a/.github/workflows/release-draft.yml b/.github/workflows/release-draft.yml new file mode 100644 index 0000000..afee4a6 --- /dev/null +++ b/.github/workflows/release-draft.yml @@ -0,0 +1,81 @@ +name: Release Draft + +on: + workflow_dispatch: # checkov:skip=CKV_GHA_7 + inputs: + bump-type: + description: Version bump type + required: true + type: choice + options: + - patch + - minor + - major + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: write + pull-requests: write + +jobs: + create-release-pr: + name: Create Release PR + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Read current version + id: current-version + run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" + + - name: Bump version + id: bump-version + uses: actions-ecosystem/action-bump-semver@34e334551143a5301f38c830e44a22273c6ff5c5 # v1.0.0 + with: + current_version: ${{ steps.current-version.outputs.version }} + level: ${{ github.event.inputs.bump-type || 'patch' }} + + - name: Write new version to VERSION + run: echo "${{ steps.bump-version.outputs.new_version }}" > VERSION + + - name: Update README.md version references + run: | + sed -i "s/implementation 'com.mparticle:server-events-sdk:.*'/implementation 'com.mparticle:server-events-sdk:${{ steps.bump-version.outputs.new_version }}'/g" README.md + sed -i "s/.*<\/version>/${{ steps.bump-version.outputs.new_version }}<\/version>/g" README.md + + - name: Update changelog + uses: thomaseizinger/keep-a-changelog-new-release@f62c3c390716df5af712ba5d94f4f4a8efc1306d # v3.1.0 + with: + tag: ${{ steps.bump-version.outputs.new_version }} + + - name: Install JDK 17 + uses: actions/setup-java@v5 + with: + distribution: "zulu" + java-version: "17" + cache: "gradle" + + - name: Smoke test - publish to Maven local + run: ./gradlew publishToMavenLocal -PVERSION=${{ steps.bump-version.outputs.new_version }} + + - name: Create Pull Request + uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0 + with: + token: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} + commit-message: "chore: prepare release ${{ steps.bump-version.outputs.new_version }}" + branch: release/${{ steps.bump-version.outputs.new_version }} + title: "chore: release ${{ steps.bump-version.outputs.new_version }}" + base: main + body: | + ## Release ${{ steps.bump-version.outputs.new_version }} + + These files should have changed during the release, if they didn't then this is likely an issue and should be investigated: + - VERSION + - README.md + - CHANGELOG.md diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml new file mode 100644 index 0000000..c0f6b29 --- /dev/null +++ b/.github/workflows/release-publish.yml @@ -0,0 +1,84 @@ +name: Release Publish + +on: + push: + branches: + - main + paths: + - VERSION + +permissions: + contents: write + +jobs: + unit-test: + name: Unit Tests + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install JDK 17 + uses: actions/setup-java@v5 + with: + distribution: "zulu" + java-version: "17" + cache: "gradle" + + - name: Run tests + run: ./gradlew test + + publish: + name: Publish to Maven Central + needs: unit-test + runs-on: ubuntu-latest + env: + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PASSWORD }} + sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} + sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Read version from VERSION + id: version + run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" + + - name: Install JDK 17 + uses: actions/setup-java@v5 + with: + distribution: "zulu" + java-version: "17" + cache: "gradle" + + - name: Publish to Maven Central + run: ./gradlew publishMavenPublicationToSonatypeRepository -PVERSION=${{ steps.version.outputs.version }} + + create-github-release: + name: Create GitHub Release + needs: [publish] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Read version from VERSION + id: version + run: echo "version=$(cat VERSION)" >> "$GITHUB_OUTPUT" + + - name: Extract release notes from CHANGELOG.md + id: release-notes + uses: ffurrer2/extract-release-notes@273da39a24fb7db106a35526c8162815faffd31d # v3.1.0 + with: + changelog_file: CHANGELOG.md + + - name: Create GitHub Release + uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0 + with: + makeLatest: true + allowUpdates: true + tag: v${{ steps.version.outputs.version }} + name: v${{ steps.version.outputs.version }} + body: ${{ steps.release-notes.outputs.release_notes }} + commit: ${{ github.sha }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 6b515ed..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,114 +0,0 @@ -name: "Release" - -on: - workflow_dispatch: - inputs: - dryRun: - description: "Do a dry run to preview instead of a real release [true/false]" - required: true - default: "true" -jobs: - # SDK release is done from public main branch. - confirm-public-repo-main-branch: - name: "Confirm release is run from public/main branch" - uses: mParticle/mparticle-workflows/.github/workflows/sdk-release-repo-branch-check.yml@main - - unit-test: - name: "Unit Tests" - needs: confirm-public-repo-main-branch - runs-on: ubuntu-latest - steps: - - name: "Checkout Branch" - uses: actions/checkout@v3 - - name: "Install JDK 11" - uses: actions/setup-java@v3 - with: - distribution: "zulu" - java-version: "11" - cache: "gradle" - - name: "Run Tests" - run: ./gradlew test - - semantic-release: - name: "Semantic Release" - needs: unit-test - runs-on: macos-latest - env: - GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} - GIT_AUTHOR_NAME: mparticle-bot - GIT_AUTHOR_EMAIL: developers@mparticle.com - GIT_COMMITTER_NAME: mparticle-bot - GIT_COMMITTER_EMAIL: developers@mparticle.com - steps: - - name: "Checkout Branch" - uses: actions/checkout@v3 - with: - token: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} - fetch-depth: 0 - ref: main - - name: "Import GPG Key" - uses: crazy-max/ghaction-import-gpg@v5 - with: - gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.GPG_PASSPHRASE }} - git_user_signingkey: true - git_commit_gpgsign: true - - name: "Semantic Release --dry-run" - if: ${{ github.event.inputs.dryRun == 'true' }} - env: - GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} - GIT_AUTHOR_NAME: mparticle-bot - GIT_AUTHOR_EMAIL: developers@mparticle.com - GIT_COMMITTER_NAME: mparticle-bot - GIT_COMMITTER_EMAIL: developers@mparticle.com - run: | - npx \ - -p lodash \ - -p semantic-release@17 \ - -p @semantic-release/changelog@5 \ - -p @semantic-release/git@9 \ - -p @semantic-release/exec@5 \ - semantic-release --dry-run - - name: "Semantic Release" - if: ${{ github.event.inputs.dryRun == 'false' }} - env: - GITHUB_TOKEN: ${{ secrets.MP_SEMANTIC_RELEASE_BOT }} - GIT_AUTHOR_NAME: mparticle-bot - GIT_AUTHOR_EMAIL: developers@mparticle.com - GIT_COMMITTER_NAME: mparticle-bot - GIT_COMMITTER_EMAIL: developers@mparticle.com - run: | - npx \ - -p lodash \ - -p semantic-release@17 \ - -p @semantic-release/changelog@5 \ - -p @semantic-release/git@9 \ - -p @semantic-release/exec@5 \ - -p conventional-changelog-conventionalcommits@7 \ - semantic-release - - sonatype-release: - name: "Sonatype Release" - needs: semantic-release - runs-on: ubuntu-latest - env: - sonatypeUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} - sonatypePassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} - mavenSigningKeyId: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY }} - mavenSigningKeyPassword: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_PASSWORD }} - steps: - - name: "Checkout Branch" - uses: actions/checkout@v3 - with: - ref: main - - name: "Install JDK 11" - uses: actions/setup-java@v3 - with: - distribution: "zulu" - java-version: "11" - cache: "gradle" - - name: "Publish" - if: ${{ github.event.inputs.dryRun == 'false'}} - run: | - ./gradlew uploadArchives -Ptarget_maven_repo=sonatype --daemon --info - \ No newline at end of file diff --git a/.scripts/maven.gradle b/.scripts/maven.gradle deleted file mode 100644 index 865e0eb..0000000 --- a/.scripts/maven.gradle +++ /dev/null @@ -1,89 +0,0 @@ -apply plugin: 'maven' - -allprojects { - ext."signing.keyId" = System.getenv("mavenSigningKeyId") - ext."signing.secretKeyRingFile" = System.getenv("mavenSigningKeyRingFile") - ext."signing.password" = System.getenv("mavenSigningKeyPassword") -} - -configurations { - deployerJars -} - -dependencies { - deployerJars "org.kuali.maven.wagons:maven-s3-wagon:1.2.1" -} - -def target_maven_repo -if (project.hasProperty('target_maven_repo')) { - target_maven_repo = project.property('target_maven_repo') -} - -if (target_maven_repo in ['sonatype', 'sonatype-snapshot']) { - apply plugin: 'signing' - def signingKey = System.getenv("mavenSigningKeyId"); - def signingPassword = System.getenv("mavenSigningKeyPassword") - signing { - required { gradle.taskGraph.hasTask("uploadArchives") } - useInMemoryPgpKeys(signingKey, signingPassword) - sign configurations.archives - } -} - -uploadArchives{ - repositories { - mavenDeployer { - if (target_maven_repo == 'sonatype') { - - beforeDeployment { - MavenDeployment deployment -> signing.signPom(deployment) - } - repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') { - authentication(userName: System.getenv('sonatypeUsername'), password: System.getenv('sonatypePassword')) - } - } else if (target_maven_repo == 'sonatype-snapshot') { - beforeDeployment { - MavenDeployment deployment -> signing.signPom(deployment) - } - repository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') { - authentication(userName: System.getenv('sonatypeUsername'), password: System.getenv('sonatypePassword')) - } - } else if (target_maven_repo == 's3') { - configuration = configurations.deployerJars - repository(url: 's3://maven.mparticle.com') - } else { - - repository(url: 'file://' + new File(System.getProperty('user.home'), '.m2/repository').absolutePath) - } - - pom.project { - version project.version - artifactId project.name - name 'mParticle server-side Java SDK' - description "mParticle SDK for server-side Java environments" - url 'https://github.com/mparticle/mparticle-java-events-sdk' - - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/license/LICENSE-2.0.txt' - } - } - - scm { - url 'https://github.com/mparticle/mparticle-java-events-sdk' - connection 'scm:git:https://github.com/mparticle/mparticle-java-events-sdk' - developerConnection 'scm:git:git@github.com:mparticle/mparticle-java-events-sdk.git' - } - - developers { - developer { - id 'mParticle' - name 'mParticle Inc.' - email 'developers@mparticle.com' - } - } - } - } - } -} diff --git a/.scripts/release.sh b/.scripts/release.sh deleted file mode 100755 index efb0654..0000000 --- a/.scripts/release.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -: ${1?"Version missing - usage: $0 x.y.z"} - -#update build.gradle -sed -i '.bak' "s/version = '.*'/version = '$1'/g" build.gradle - -#update README.md -sed -i '.bak' "s/'com.mparticle:server-events-sdk:.*'/'com.mparticle:server-events-sdk:$1'/g" README.md -sed -i '.bak' "s/.*$1 \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null -APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s +' "$PWD" ) || exit # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -97,92 +133,120 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac fi -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. # For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) fi - i=$((i+1)) + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" fi +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index 24467a1..9b42019 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -13,8 +13,10 @@ @rem See the License for the specific language governing permissions and @rem limitations under the License. @rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem -@if "%DEBUG%" == "" @echo off +@if "%DEBUG%"=="" @echo off @rem ########################################################################## @rem @rem Gradle startup script for Windows @@ -25,10 +27,14 @@ if "%OS%"=="Windows_NT" setlocal set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,13 +43,13 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if %ERRORLEVEL% equ 0 goto execute -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail @@ -51,48 +57,36 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd +if %ERRORLEVEL% equ 0 goto mainEnd :fail rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% :mainEnd if "%OS%"=="Windows_NT" endlocal diff --git a/release.config.js b/release.config.js deleted file mode 100644 index 16d6260..0000000 --- a/release.config.js +++ /dev/null @@ -1,100 +0,0 @@ -module.exports = { - branches: ["main"], - tagFormat: "v${version}", - plugins: [ - [ - "@semantic-release/commit-analyzer", - { - preset: "angular", - releaseRules: [ - {type: 'feat', release: 'minor'}, - {type: 'ci', release: 'patch'}, - {type: 'fix', release: 'patch'}, - {type: 'docs', release: 'patch'}, - {type: 'test', release: 'patch'}, - {type: 'refactor', release: 'patch'}, - {type: 'style', release: 'patch'}, - {type: 'build', release: 'patch'}, - {type: 'chore', release: 'patch'}, - {type: 'revert', release: 'patch'} - ] - } - ], - [ - "@semantic-release/release-notes-generator", - { - preset: "conventionalcommits", - presetConfig: { - types: [ - { - "type": "feat", - "section": "Features", - "hidden": false - }, - { - "type": "fix", - "section": "Bug Fixes", - "hidden": false - }, - { - "type": "docs", - "section": "Documentation", - "hidden": false - }, - { - "type": "style", - "section": "Updates & Maintenance", - "hidden": false - }, - { - "type": "refactor", - "section": "Updates & Maintenance", - "hidden": false - }, - { - "type": "perf", - "section": "Updates & Maintenance", - "hidden": false - }, - { - "type": "test", - "section": "Updates & Maintenance", - "hidden": false - }, - { - "type": "ci", - "section": "Updates & Maintenance", - "hidden": false - }, - { - "type": "chore", - "section": "Updates & Maintenance", - "hidden": false - } - ] - } - } - ], - [ - "@semantic-release/changelog", - { - changelogFile: "CHANGELOG.md", - }, - ], - [ - "@semantic-release/exec", - { - prepareCmd: "sh ./.scripts/release.sh ${nextRelease.version}", - }, - ], - ["@semantic-release/github"], - [ - "@semantic-release/git", - { - assets: ["CHANGELOG.md", "build.gradle", "README.md"], - message: - "chore: ${nextRelease.version} (release) \n\n${nextRelease.notes}", - }, - ], - ], -};