From e6ef4e232eb045a1a7f781f4350a0aafe5ceb8c8 Mon Sep 17 00:00:00 2001 From: Marco Collovati Date: Sun, 31 Dec 2023 11:13:14 +0100 Subject: [PATCH] chore(actions): fix classifier deploy workflow (#88) Project release versions are not committed anymore during release. This change computes latest release version from tag and updates the maven POMs before building and deploying the artifact with Vaadin classifier. It also handles search for existing classifiers on repsy release and snapshots repositories --- .github/workflows/deploy-classifiers.yml | 18 ++++++++- README.md | 49 ++++++++++++++++++------ tools/build_flow_widgetsets.sh | 26 +++++++++++-- vaadin-flow-sockjs/pom.xml | 3 +- 4 files changed, 79 insertions(+), 17 deletions(-) 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/README.md b/README.md index ccfbcfc4..0376829a 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,8 @@ Vertx-vaadin binaries are available on Maven Central and Bintray. ### Maven +Stable artifacts are published on Maven Central. + ```xml com.github.mcollovati.vertx @@ -29,22 +31,47 @@ Vertx-vaadin binaries are available on Maven Central and Bintray. ``` +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 + + com.github.mcollovati.vertx + vaadin-flow-sockjs + ${vertx-vaadin-flow.version} + vaadin-${vaadin.version} + +``` -Snapshot are currently published on [Repsy](https://repsy.io/) +Snapshots and `vaadin-flow-sockjs` classifiers are currently published on [Repsy](https://repsy.io/). ```xml - - vertx-vaadin-snapshots - https://repo.repsy.io/mvn/mcollovati/vertx-vaadin-snapshots - - false - - - true - - + + + vertx-vaadin + https://repo.repsy.io/mvn/mcollovati/vertx-vaadin + + true + + + false + + + + vertx-vaadin-snapshots + https://repo.repsy.io/mvn/mcollovati/vertx-vaadin-snapshots + + false + + + true + + + ``` + + ## Compatibility matrix | Vaadin version | Vert.x version | vertx-vaadin version | Status | diff --git a/tools/build_flow_widgetsets.sh b/tools/build_flow_widgetsets.sh index 39d78ed5..7a343998 100755 --- a/tools/build_flow_widgetsets.sh +++ b/tools/build_flow_widgetsets.sh @@ -8,7 +8,6 @@ # kind : artifact type (snapshot, release), defaults to 'release' # ####### - _base_dir="$(dirname $(realpath $0))/.." _action=${1:-package} _kind=${2:-release} @@ -47,8 +46,21 @@ function get_vaadin_versions() { get_vaadin_versions #"versions" echo "Search for existing classifiers..." -__existing_classifiers=$(curl -s https://repo.repsy.io/mvn/mcollovati/vertx-vaadin-snapshots/com/github/mcollovati/vertx/vaadin-flow-sockjs/${_current_version}/maven-metadata.xml \ - | grep "vaadin-" | sed -E 's/^.*vaadin-(.*)<\/classifier>.*/\1/g' | sort -r -t '.' || echo '') + +__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 version ${_current_version} ===> ${__existing_classifiers}" echo @@ -57,6 +69,12 @@ 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 @@ -65,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 93abccfc..89f4ef2f 100644 --- a/vaadin-flow-sockjs/pom.xml +++ b/vaadin-flow-sockjs/pom.xml @@ -409,7 +409,8 @@ ${project.version} ${project.packaging} vaadin-${vaadin.platform.version} - false + true + true --pinentry-mode loopback