diff --git a/.github/workflows/deploy-classifiers.yml b/.github/workflows/deploy-classifiers.yml index dd1bf911..88ddd33c 100644 --- a/.github/workflows/deploy-classifiers.yml +++ b/.github/workflows/deploy-classifiers.yml @@ -2,6 +2,11 @@ name: Deploy vaadin-flow-sockjs classifiers on: workflow_dispatch: + inputs: + script-from-branch: + description: "Checkout deploy script from dispatching branch" + type: boolean + default: false schedule: - cron: '0 2 * * *' @@ -22,7 +27,15 @@ jobs: ref: ${{ matrix.branch }} fetch-depth: 0 - name: Checkout latest tag - run: git checkout $(git describe --abbrev=0 --tags --match="flow-*") + id: checkout-tag + run: | + TAG=$(git describe --abbrev=0 --tags --match="flow-*") + VERSION=${TAG/flow-/} + echo "vertx-vaadin-version=${VERSION}" >> "$GITHUB_OUTPUT" + git checkout $TAG + - name: Checkout deploy script + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.script-from-branch }} + run: git checkout $GITHUB_WORKFLOW_SHA -- tools/build_flow_widgetsets.sh - name: Set up Java uses: actions/setup-java@v3 with: # running setup-java again overwrites the settings.xml @@ -33,8 +46,11 @@ jobs: server-password: REPSY_PASSWORD gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase + - name: Set version + run: mvn -N -ntp versions:set -DnewVersion="${{ steps.checkout-tag.outputs.vertx-vaadin-version }}" - name: Deploy classifiers run: | + set -x -e -o pipefail ./mvnw -N -ntp install PRJ_VERSION=$(./mvnw -pl :vaadin-flow-sockjs help:evaluate -q -Dexpression='project.version' -DforceStdout) KIND=$( [[ "${PRJ_VERSION}" =~ "-SNAPSHOT"$ ]] && echo "snapshot" || echo "release" ) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 00000000..6e5cca27 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,111 @@ +name: Release +run-name: "Release ${{ inputs.version }} from branch ${{ inputs.target-branch }} ${{ inputs.dry-run && '(DRY RUN)' || ''}}" +on: + workflow_dispatch: + inputs: + target-branch: + description: "Branch to release" + required: true + type: choice + default: 'development' + options: + - "development" + version: + description: "Version to release (e.g. 1.1.0 or 1.2.0-alpha1)" + required: true + type: string + dry-run: + description: "Dry run (skips remote operations)" + required: true + type: boolean + default: false + close-repository: + description: "Automatically close and release Maven Central staging repository (default true)" + required: true + type: boolean + default: true +jobs: + release: + name: Release + runs-on: ubuntu-latest + + steps: + - uses: actions-cool/check-user-permission@main + id: checkUser + with: + username: ${{github.triggering_actor}} + check-contributor: true + require: 'write' + - name: Fail on workflow triggered by external contributor + if: ${{ steps.checkUser.outputs.require-result != 'true' }} + run: | + echo "🚫 **${{ github.actor }}** is an external contributor, only **${{ github.repository }}** team members can perform a release" \ + | tee -a $GITHUB_STEP_SUMMARY && exit 1 + - name: Validate Workflow branch + if: ${{ !github.event.inputs.dry-run }} + run: | + BRANCH_NAME=${GITHUB_REF##*/} + if [[ "development" != "${BRANCH_NAME}" ]]; then + echo "🚫 Release Workflow must be dispatched on 'development' branch." \ + | tee -a $GITHUB_STEP_SUMMARY + exit 1 + fi + + - name: Checkout + uses: actions/checkout@v3 + with: + ref: refs/heads/${{ inputs.target-branch }} + fetch-depth: 0 + + - name: Validate version + run: | + VERSION_REGEX='^[0-9]+\.[0-9]+\.[0-9]+(-(alpha|beta|rc)[0-9]+)?$' + if [[ ! "${{ inputs.version }}" =~ $VERSION_REGEX ]]; then + echo "🚫 Invalid version specified: '${{ inputs.version }}'. Please enter a valid SemVer version, like '1.2.3' or '1.0.0-alpha1'." \ + | tee -a $GITHUB_STEP_SUMMARY + exit 1 + fi + #if [[ "${{ inputs.target-branch }}" != "development" && ! "${{ inputs.version }}" = "${{ inputs.target-branch }}."* ]]; then + # echo "🚫 Invalid version specified: '${{ inputs.version }}' does not match the release branch '${{ inputs.target-branch }}'." \ + # | tee -a $GITHUB_STEP_SUMMARY + # exit 1 + #fi + if git rev-parse -q --verify "refs/tags/flow-${{ inputs.version }}" > /dev/null; then + echo "🚫 Version '${{ inputs.version }}' already exists. Please choose a different version." \ + | tee -a $GITHUB_STEP_SUMMARY + exit 1 + fi + echo "Releasing version '${{ inputs.version }}' from branch '${{ inputs.target-branch }}'." | tee -a $GITHUB_STEP_SUMMARY + if [[ "${{ github.event.inputs.dry-run }}" == "true" ]]; then + echo "⚠️ dry-run execution, artifacts will not be published on Maven Central." | tee -a $GITHUB_STEP_SUMMARY + fi + - name: Setup Java + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'temurin' + - name: Set version + run: + mvn -N -ntp versions:set -DnewVersion="${{ inputs.version }}" + - name: Staging artifacts + run: | + mvn -V -ntp -Prelease -DaltDeploymentRepository=local::file:./target/staging-deploy -DskipTests deploy + + - name: Run JReleaser + env: + JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_GPG_PUBLIC }} + JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + run: | + mvn -N -V -ntp -Prelease -Djreleaser.dry.run="${{ github.event.inputs.dry-run }}" -Dvertx-vaadin.release.closeRepository="${{ github.event.inputs.close-repository }}" -DskipTests jreleaser:full-release + + - name: JReleaser release output + if: always() + uses: actions/upload-artifact@v3 + with: + name: jreleaser-release + path: | + target/jreleaser/** diff --git a/.github/workflows/validation.yml b/.github/workflows/validation.yml index 593c513d..6fdfea6e 100644 --- a/.github/workflows/validation.yml +++ b/.github/workflows/validation.yml @@ -34,6 +34,7 @@ jobs: runs-on: ubuntu-latest outputs: validation-required: ${{ steps.filter.outputs.validate }} + deploy-required: ${{ steps.filter.outputs.deploy }} steps: - name: Checkout uses: actions/checkout@v3 @@ -45,6 +46,18 @@ jobs: filters: | validate: - '!(README.md|LICENSE|.gitignore|tools/**)' + deploy: + - 'pom.xml' + - 'vertx-vaadin-flow/pom.xml' + - 'vertx-vaadin-flow/src/**' + - 'vaadin-flow-sockjs/pom.xml' + - 'vaadin-flow-sockjs/src/**' + - 'vertx-vaadin-flow-jandex/pom.xml' + - 'vertx-vaadin-quarkus-extension/pom.xml' + - 'vertx-vaadin-quarkus-extension/runtime/pom.xml' + - 'vertx-vaadin-quarkus-extension/runtime/src/**' + - 'vertx-vaadin-quarkus-extension/deployment/pom.xml' + - 'vertx-vaadin-quarkus-extension/deployment/src/**' build: name: Build needs: [changes] @@ -282,7 +295,7 @@ jobs: permissions: contents: read packages: write - if: ${{ success() && github.event_name == 'push' && github.ref_protected }} + if: ${{ success() && github.event_name == 'push' && github.ref_protected && needs.changes.outputs.deploy-required == 'true'}} steps: - uses: actions/checkout@v4 with: diff --git a/.gitignore b/.gitignore index 0535aad1..e4267182 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .vertx/ uber-pom.xml +.flattened-pom.xml node_modules/ package.json package-lock.json diff --git a/README.md b/README.md index 849c9cba..0376829a 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ ![License](https://img.shields.io/github/license/mcollovati/vertx-vaadin.svg) ![Maven Central](https://img.shields.io/maven-central/v/com.github.mcollovati.vertx/vertx-vaadin-flow.svg?label=vertx-vaadin-flow) +![Repsy Snapshots](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Frepo.repsy.io%2Fmvn%2Fmcollovati%2Fvertx-vaadin-snapshots%2Fcom%2Fgithub%2Fmcollovati%2Fvertx%2Fvertx-vaadin-flow%2Fmaven-metadata.xml&label=repsy%20(snapshots)) + ## Description @@ -18,7 +20,8 @@ This means you can mix the simplicity and robustness of Vaadin applications with Vertx-vaadin binaries are available on Maven Central and Bintray. ### Maven -``` + +Stable artifacts are published on Maven Central. ```xml @@ -28,38 +31,52 @@ Vertx-vaadin binaries are available on Maven Central and Bintray. ``` - -Snapshot are currently published on GitHub, so a [Personal Access Token](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-apache-maven-registry#authenticating-with-a-personal-access-token) -is required to download the artifacts +For better compatibility with Flow client, specific `vaadin-flow-sockjs` artifacts targeting exact Vaadin versions +in use are published using the `vaadin-${vaadin.version}` classifier. ```xml - - vertx-vaadin-snapshots - https://maven.pkg.github.com/mcollovati/vertx-vaadin - - false - - - true - - + + com.github.mcollovati.vertx + vaadin-flow-sockjs + ${vertx-vaadin-flow.version} + vaadin-${vaadin.version} + ``` -In setting.xml +Snapshots and `vaadin-flow-sockjs` classifiers are currently published on [Repsy](https://repsy.io/). + ```xml - + + + vertx-vaadin + https://repo.repsy.io/mvn/mcollovati/vertx-vaadin + + true + + + false + + + vertx-vaadin-snapshots - your username - PAT with read:packages - + https://repo.repsy.io/mvn/mcollovati/vertx-vaadin-snapshots + + false + + + true + + + ``` + + ## Compatibility matrix -| Vaadin version | Vert.x version | vertx-vaadin version |Status| -|----------------|--------------|--------------------------|------| -| 23.1.1 | 4.2.3 | vertx-vaadin-flow:23.1.x |[![CircleCI](https://circleci.com/gh/mcollovati/vertx-vaadin/tree/development.svg?style=svg)](https://circleci.com/gh/mcollovati/vertx-vaadin/tree/development)| -| 23.3 | 4.3 | vertx-vaadin-flow:23.3.x |[![CircleCI](https://circleci.com/gh/mcollovati/vertx-vaadin/tree/development.svg?style=svg)](https://circleci.com/gh/mcollovati/vertx-vaadin/tree/development)| +| Vaadin version | Vert.x version | vertx-vaadin version | Status | +|----------------|--------------|--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| 23.3 | 4.3 | vertx-vaadin-flow:23.4.x | ![Development](https://github.com/mcollovati/vertx-vaadin/actions/workflows/validation.yml/badge.svg?event=push&branch=development) | ## Documentation diff --git a/pom.xml b/pom.xml index 1a79236c..48365014 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,8 @@ true repsy-vertx-vaadin-snapshots - https://repo.repsy.io/mvn/mcollovati/vertx-vaadin-snapshots + https://repo.repsy.io/mvn/mcollovati/vertx-vaadin-snapshots + repsy-vertx-vaadin https://repo.repsy.io/mvn/mcollovati/vertx-vaadin @@ -103,6 +104,8 @@ 3.1.0 3.3.2 3.1.1 + 1.5.0 + 1.9.0 4.3.0 23.3.30 @@ -385,6 +388,7 @@ true + org.sonatype.plugins nexus-staging-maven-plugin ${nexus-staging-maven-plugin.version} + + org.jreleaser + jreleaser-maven-plugin + ${jreleaser-maven-plugin.version} + + + org.codehaus.mojo + flatten-maven-plugin + ${flatten-maven-plugin.version} + @@ -434,6 +449,11 @@ release + + MEMORY + ALWAYS + true + @@ -462,6 +482,105 @@ + + org.codehaus.mojo + flatten-maven-plugin + + ${project.basedir} + true + oss + + remove + + + + + flatten + process-classes + + flatten + + + + flatten.clean + clean + + clean + + + + + + org.jreleaser + jreleaser-maven-plugin + false + + + + + mcollovati + vertx-vaadin + + ALWAYS + conventional-commits + true + + + merge + tasks + build + + + GitHub + [bot] + + + + - {{contributorName}} + + + true + flow-{{projectVersion}} + Release flow-{{tagName}} + + .*-(alpha|beta|rc)\d+ + + + true + This issue has been resolved in `{{tagName}}` ([Release Notes]({{releaseNotesUrl}})) + ALWAYS + + + + + + + + + ${release.mavencentral.active} + https://oss.sonatype.org/service/local + + https://s01.oss.sonatype.org/content/repositories/snapshots/ + + ${vertx-vaadin.release.closeRepository} + ${vertx-vaadin.release.closeRepository} + target/staging-deploy + + + + + + ALWAYS + ${jreleaser.signing.mode} + true + + + + diff --git a/tools/build_flow_widgetsets.sh b/tools/build_flow_widgetsets.sh index 4074457c..7a343998 100755 --- a/tools/build_flow_widgetsets.sh +++ b/tools/build_flow_widgetsets.sh @@ -7,10 +7,7 @@ # action : maven goal to execute, defaults to 'package' # kind : artifact type (snapshot, release), defaults to 'release' # -# cat maven-metadata.xml | grep "" | sed 's/^.*\([^<]*\)<.*/\1/g' | sort -r -# curl -s https://repo1.maven.org/maven2/com/vaadin/vaadin-core/maven-metadata.xml | grep "23\..*" | sed -E 's/^.*(.*)<\/version>.*/\1/g' | sort -r -t '.' ####### - _base_dir="$(dirname $(realpath $0))/.." _action=${1:-package} _kind=${2:-release} @@ -48,26 +45,36 @@ function get_vaadin_versions() { } get_vaadin_versions #"versions" -###versions=("${versions[@]:9:3}") echo "Search for existing classifiers..." -declare -A _existing_versions -for version in "${versions[@]}"; do - flag=$( - mvn -N -q dependency:get -Dartifact=com.github.mcollovati.vertx:vaadin-flow-sockjs:${_current_version}:jar:vaadin-${version} \ - -DremoteRepositories=repsy-vertx-vaadin::::https://repo.repsy.io/mvn/mcollovati/vertx-vaadin/ -Dtransitive=false 2>&1 >/dev/null && \ - echo 1 || echo 0 - ) - echo " --> Searching classifier vaadin-${version} for version ${_current_version} ===> ${flag}" - if [[ "${flag}" = "1" ]]; then - _existing_versions[$version]=$version - fi -done +__repo_name=vertx-vaadin +if [[ "${_kind}" = "snapshot" ]]; then + __repo_name="${__repo_name}-snapshots" +fi +__base_url="https://repo.repsy.io/mvn/mcollovati/${__repo_name}/com/github/mcollovati/vertx/vaadin-flow-sockjs/${_current_version}" +if [[ "$(curl -s -o /dev/null -w '%{http_code}' ${__base_url}/maven-metadata.xml)" = "200" ]]; then + __existing_classifiers=$(curl -s ${__base_url}/maven-metadata.xml \ + | grep "vaadin-" | sed -E 's/^.*vaadin-(.*)<\/classifier>.*/\1/g' | sort -r -t '.' || echo '') +else + # Extract existing versions from directory listing + __pattern='href="vaadin-flow-sockjs-23.4.0-alpha1-vaadin-([^"]+)\.jar\"' + __existing_classifiers=$(curl -s ${__base_url}/ | sed -E -e "/${__pattern}/!d" -e "s/.*${__pattern}.*/\1/g" || echo '') +fi -echo "Existing classifiers for ${_current_version}:" -echo "${_existing_versions[@]}" +echo "Existing classifiers for version ${_current_version} ===> ${__existing_classifiers}" echo +declare -A _existing_versions +for v in ${__existing_classifiers}; do + _existing_versions[$v]=$v +done + +#if [[ ${#_existing_versions[@]} -eq 0 ]]; then +# echo "deploy base version" +# $_mvn -B -ntp -pl :vaadin-flow-sockjs -Dvertx-vaadin.release=${_kind} -DskipTests -Dvaadin.platform.version=${version} -Dvaadin.flow.version=${flow_client_version} $_mvn_target ${DEPLOY_OPTS} +# _last_built=${flow_client_version} +#fi + _last_built="" for version in "${versions[@]}"; do @@ -76,7 +83,7 @@ for version in "${versions[@]}"; do else echo "Building classifier vaadin-${version} for version ${_current_version}" echo "Find flow-client version for vaadin ${version}..." - flow_client_version=$($_mvn -Pfind-flow-client-version -q dependency:list -Dvaadin.platform.version=${version} \ + flow_client_version=$($_mvn -N -ntp -Pfind-flow-client-version -q dependency:list -Dvaadin.platform.version=${version} \ -DincludeArtifactIds=flow-client -DoutputFile=$_base_dir/target/flow-client.version && \ cat $_base_dir/target/flow-client.version | grep 'com.vaadin:flow-client' | cut -d ':' -f 4) diff --git a/vaadin-flow-sockjs/pom.xml b/vaadin-flow-sockjs/pom.xml index d3fc625f..89f4ef2f 100644 --- a/vaadin-flow-sockjs/pom.xml +++ b/vaadin-flow-sockjs/pom.xml @@ -340,10 +340,6 @@ - - com.igormaznitsa - uber-pom - @@ -413,7 +409,8 @@ ${project.version} ${project.packaging} vaadin-${vaadin.platform.version} - false + true + true --pinentry-mode loopback diff --git a/vertx-vaadin-flow-jandex/pom.xml b/vertx-vaadin-flow-jandex/pom.xml index 5bbfda56..9a431892 100644 --- a/vertx-vaadin-flow-jandex/pom.xml +++ b/vertx-vaadin-flow-jandex/pom.xml @@ -81,11 +81,52 @@ - - com.igormaznitsa - uber-pom - + + + release + + true + true + + + + + org.apache.maven.plugins + maven-jar-plugin + + + empty-javadocs + package + + jar + + + javadoc + + ** + + + + + empty-sources + package + + jar + + + sources + + ** + + + + + + + + + \ No newline at end of file diff --git a/vertx-vaadin-flow/pom.xml b/vertx-vaadin-flow/pom.xml index 325cdb7a..cd310e3b 100644 --- a/vertx-vaadin-flow/pom.xml +++ b/vertx-vaadin-flow/pom.xml @@ -262,10 +262,6 @@ - - com.igormaznitsa - uber-pom - diff --git a/vertx-vaadin-quarkus-extension/deployment/pom.xml b/vertx-vaadin-quarkus-extension/deployment/pom.xml index 13170e98..1d576aaf 100644 --- a/vertx-vaadin-quarkus-extension/deployment/pom.xml +++ b/vertx-vaadin-quarkus-extension/deployment/pom.xml @@ -10,6 +10,7 @@ vertx-vaadin-quarkus-extension-deployment Vertx Vaadin Extension - Deployment + Vertx Vaadin Extension - Deployment io.quarkus @@ -44,16 +45,6 @@ - - com.igormaznitsa - uber-pom - - - default - none - - - diff --git a/vertx-vaadin-quarkus-extension/integration-tests/pom.xml b/vertx-vaadin-quarkus-extension/integration-tests/pom.xml index c674ee60..eb6ef8b2 100644 --- a/vertx-vaadin-quarkus-extension/integration-tests/pom.xml +++ b/vertx-vaadin-quarkus-extension/integration-tests/pom.xml @@ -29,6 +29,8 @@ true + true + true @@ -69,4 +71,28 @@ + + + release + + + + org.codehaus.mojo + flatten-maven-plugin + + + flatten + none + + + flatten.clean + none + + + + + + + + diff --git a/vertx-vaadin-quarkus-extension/integration-tests/production/pom.xml b/vertx-vaadin-quarkus-extension/integration-tests/production/pom.xml index ec295984..1a363956 100644 --- a/vertx-vaadin-quarkus-extension/integration-tests/production/pom.xml +++ b/vertx-vaadin-quarkus-extension/integration-tests/production/pom.xml @@ -159,36 +159,6 @@ - - com.lazerycode.selenium - driver-binary-downloader-maven-plugin - - - ${driver.binary.downloader.maven.plugin.version} - - - - javax.xml.bind - jaxb-api - 2.2.11 - - - com.sun.xml.bind - jaxb-core - 2.2.11 - - - com.sun.xml.bind - jaxb-impl - 2.2.11 - - - com.sun.activation - javax.activation - 1.2.0 - - - diff --git a/vertx-vaadin-quarkus-extension/pom.xml b/vertx-vaadin-quarkus-extension/pom.xml index 49b4c6eb..b029ca4f 100644 --- a/vertx-vaadin-quarkus-extension/pom.xml +++ b/vertx-vaadin-quarkus-extension/pom.xml @@ -88,11 +88,5 @@ - - - com.igormaznitsa - uber-pom - - diff --git a/vertx-vaadin-quarkus-extension/runtime/pom.xml b/vertx-vaadin-quarkus-extension/runtime/pom.xml index d3af56c5..12b8a794 100644 --- a/vertx-vaadin-quarkus-extension/runtime/pom.xml +++ b/vertx-vaadin-quarkus-extension/runtime/pom.xml @@ -10,6 +10,7 @@ vertx-vaadin-quarkus-extension Vertx Vaadin Extension - Runtime + Vertx Vaadin Extension - Runtime @@ -97,16 +98,6 @@ - - com.igormaznitsa - uber-pom - - - default - none - - -