Skip to content

Commit

Permalink
chore(actions): fix classifier deploy workflow (#88)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mcollovati authored Dec 31, 2023
1 parent 618fb07 commit e6ef4e2
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 17 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/deploy-classifiers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 * * *'

Expand All @@ -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
Expand All @@ -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" )
Expand Down
49 changes: 38 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Vertx-vaadin binaries are available on Maven Central and Bintray.

### Maven

Stable artifacts are published on Maven Central.

```xml
<dependency>
<groupId>com.github.mcollovati.vertx</groupId>
Expand All @@ -29,22 +31,47 @@ Vertx-vaadin binaries are available on Maven Central and Bintray.
</dependency>
```

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
<dependency>
<groupId>com.github.mcollovati.vertx</groupId>
<artifactId>vaadin-flow-sockjs</artifactId>
<version>${vertx-vaadin-flow.version}</version>
<classifier>vaadin-${vaadin.version}</classifier>
</dependency>
```

Snapshot are currently published on [Repsy](https://repsy.io/)
Snapshots and `vaadin-flow-sockjs` classifiers are currently published on [Repsy](https://repsy.io/).

```xml
<repository>
<id>vertx-vaadin-snapshots</id>
<url>https://repo.repsy.io/mvn/mcollovati/vertx-vaadin-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repositories>
<repository>
<id>vertx-vaadin</id>
<url>https://repo.repsy.io/mvn/mcollovati/vertx-vaadin</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>vertx-vaadin-snapshots</id>
<url>https://repo.repsy.io/mvn/mcollovati/vertx-vaadin-snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
```



## Compatibility matrix

| Vaadin version | Vert.x version | vertx-vaadin version | Status |
Expand Down
26 changes: 22 additions & 4 deletions tools/build_flow_widgetsets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
# kind : artifact type (snapshot, release), defaults to 'release'
#
#######

_base_dir="$(dirname $(realpath $0))/.."
_action=${1:-package}
_kind=${2:-release}
Expand Down Expand Up @@ -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 "<classifier>vaadin-" | sed -E 's/^.*<classifier>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 "<classifier>vaadin-" | sed -E 's/^.*<classifier>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

Expand All @@ -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

Expand All @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion vaadin-flow-sockjs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,8 @@
<version>${project.version}</version>
<packaging>${project.packaging}</packaging>
<classifier>vaadin-${vaadin.platform.version}</classifier>
<generatePom>false</generatePom>
<generatePom>true</generatePom>
<updateReleaseInfo>true</updateReleaseInfo>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
Expand Down

0 comments on commit e6ef4e2

Please sign in to comment.