diff --git a/.devenv/README.md b/.devenv/README.md new file mode 100644 index 000000000..b80ba462e --- /dev/null +++ b/.devenv/README.md @@ -0,0 +1,68 @@ +# GWT Development Environment + +This repository provides a development environment for the Google Web Toolkit (GWT) using Nix flakes. It sets up the necessary tools and dependencies to build and develop GWT applications efficiently. + +## Features + +- **JDK 17**: The development environment includes JDK 17 for Java development. + +- **Apache Ant**: Build tool for automating software build processes. + +- **Maven**: Dependency management and project management tool for Java projects. + +- **GWT Tools**: Includes GWT-specific tools for building and running GWT applications. + +## Getting Started + +### Prerequisites + +- Ensure you have [Nix](https://nixos.org/download.html) installed on your system. +- Enable flakes support by adding the following line to your Nix configuration: + + ```bash + experimental-features = nix-command flakes + ``` + +## Usage + +### Enter the Development Shell + +To enter the development shell with all necessary dependencies, run: + + ```bash + nix develop + ``` + +### Build the GWT Application: +You can package your GWT application using the provided build script: + + ```bash + nix run .devenv#build-gwt + ``` + +### Environment Variables + +- `GWT_VERSION`: Set this environment variable to specify a custom GWT version. +- `GWT_TOOLS`: This variable points to the GWT tools used in the environment. + +### Directory Structure + +- `flake.nix`: The main Nix flake file that defines the development environment and packages. +- `gwt-version.sh`: A script to compute the current GWT version based on the project files. +- `git-rev.sh`: A script to compute the current git revision based on the project files. +- `gwt-packages/flake.nix`: The flake file that defines the packages. +- `gwt-packages/gwt.nix`: The derivation for the GWT package. +- `gwt-packages/gwtTools.nix`: The derivation for the GWT tools package. + +## Contributing + +Contributions are welcome! If you have suggestions or improvements, feel free to open an issue or submit a pull request. + +## License + +This project is licensed under the MIT License - see the LICENSE file for details. + +## Acknowledgments + +Thanks to the Nix community for their support and resources. +Special thanks to the GWT community for providing the tools and documentation that make this project possible. diff --git a/.devenv/build-gwt.sh b/.devenv/build-gwt.sh new file mode 100755 index 000000000..05542c404 --- /dev/null +++ b/.devenv/build-gwt.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env -S bash -e -o pipefail + +[[ -n "${RUNNER_DEBUG}" ]] && + set -x + +root=$(git rev-parse --show-toplevel 2>/dev/null) +if [ -z "$root" ]; then + echo "Error: Not in a Git repository" >&2 + exit 1 +fi + +current_dir=$(pwd) +if [[ "$current_dir" != "$root"* ]]; then + echo "Error: Current directory is not within the Git worktree" >&2 + exit 1 +fi + +if [ ! -d "${root}/.devenv" ]; then + echo "Error: .devenv directory not found in Git root" >&2 + exit 1 +fi + +if [ -z "$GWT_VERSION" ]; then + echo "Error: GWT_VERSION is not set" >&2 + exit 1 +fi + +if [ -z "$GIT_REV" ]; then + echo "Error: GIT_REV is not set" >&2 + exit 1 +fi + +echo "Building GWT ${GWT_VERSION}:${GIT_REV} development distribution package version" + +exec nix build --impure --out-link "${root}/.devenv/dist/result" "${root}/.devenv/dist#gwt" diff --git a/.devenv/custom.ant.macrodefs.xml b/.devenv/custom.ant.macrodefs.xml new file mode 100644 index 000000000..f25273bad --- /dev/null +++ b/.devenv/custom.ant.macrodefs.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/.devenv/dist/common.ant.xml.patch b/.devenv/dist/common.ant.xml.patch new file mode 100644 index 000000000..7414273b2 --- /dev/null +++ b/.devenv/dist/common.ant.xml.patch @@ -0,0 +1,29 @@ +diff --git a/common.ant.xml b/common.ant.xml +index 36a56b488..b61cd36e9 100755 +--- a/common.ant.xml ++++ b/common.ant.xml +@@ -310,13 +310,19 @@ + + + +- ++ ++ ++ ++ ++ ++ ++ + + +- ++ ++ ++ ++ + + diff --git a/.devenv/dist/flake.lock b/.devenv/dist/flake.lock new file mode 100644 index 000000000..240098e2e --- /dev/null +++ b/.devenv/dist/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1722062969, + "narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/.devenv/dist/flake.nix b/.devenv/dist/flake.nix new file mode 100644 index 000000000..8089668d0 --- /dev/null +++ b/.devenv/dist/flake.nix @@ -0,0 +1,41 @@ +{ + description = "GWT and GWT Tools packages"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + defaultGwtVersion = "0.0.0-dev"; + defaultGitRev = "0000000"; + gwtVersion = builtins.getEnv "GWT_VERSION"; + gitRev = builtins.getEnv "GIT_REV"; + + mkGwtTools = { gwtVersion ? defaultGwtVersion }: + pkgs.callPackage ./tools.nix { inherit gwtVersion; }; + + mkGwt = { gwtVersion ? defaultGwtVersion, gitRev ? defaultGitRev }: + pkgs.callPackage ./gwt.nix { + inherit gwtVersion gitRev; + gwtTools = mkGwtTools { inherit gwtVersion; }; + }; + in + { + packages = { + gwtTools = mkGwtTools { + gwtVersion = if gwtVersion != "" then gwtVersion else defaultGwtVersion; + }; + gwt = mkGwt { + gwtVersion = if gwtVersion != "" then gwtVersion else defaultGwtVersion; + gitRev = if gitRev != "" then gitRev else defaultGitRev; + }; + }; + + defaultPackage = self.packages.${system}.gwt; + } + ); +} diff --git a/.devenv/dist/gwt.nix b/.devenv/dist/gwt.nix new file mode 100644 index 000000000..7c128cedf --- /dev/null +++ b/.devenv/dist/gwt.nix @@ -0,0 +1,64 @@ +{ lib, stdenv, unzip, patch, rsync, jdk17, ant, git, which, coreutils, gnused, gnugrep, gwtVersion, gitRev, gwtTools }: + +stdenv.mkDerivation { + pname = "gwt"; + version = gwtVersion; + + src = lib.cleanSourceWith { + filter = name: type: let baseName = baseNameOf (toString name); in + !(lib.hasPrefix "." baseName) || baseName == ".devenv"; + src = ../../.; # Use the parent directory as the source + }; + + sourceRoot = "."; + + nativeBuildInputs = [ unzip git which coreutils gnused gnugrep patch rsync ]; + buildInputs = [ jdk17 ant ]; + + unpackPhase = '' + runHook preUnpack + + rsync -av --chmod=u+rw $src/. . + + runHook postUnpack + ''; + + patchPhase = '' + runHook prePatch + + patch -p1 < ${ ./common.ant.xml.patch } + + runHook postPatch + ''; + + buildPhase = '' + runHook preBuild + + export GWT_TOOLS="${lib.escapeShellArg gwtTools}" + export GWT_VERSION="${gwtVersion}" + export GIT_REV="${gitRev}" + + echo "Building GWT $${GWT_VERSION}:$${GIT_REV} using GWT_TOOLS=$${GWT_TOOLS}" + + env JAVA_HOME="${jdk17}" ant -f build.xml \ + -lib ${gwtTools}/lib -Dgwt.tools=${gwtTools} dist-dev + + runHook postBuild + ''; + + installPhase = '' + runHook preInstall + + mkdir -p $out + rsync -av --progress build/dist/ $out/ + + runHook postInstall + ''; + + meta = with lib; { + homepage = "http://www.gwtproject.org/"; + description = "Google Web Toolkit"; + license = licenses.asl20; + platforms = platforms.unix; + }; +} diff --git a/.devenv/dist/tools.nix b/.devenv/dist/tools.nix new file mode 100644 index 000000000..5937f4d77 --- /dev/null +++ b/.devenv/dist/tools.nix @@ -0,0 +1,28 @@ +{ stdenv, lib, fetchFromGitHub, gwtVersion }: + +stdenv.mkDerivation rec { + pname = "gwtTools"; + version = gwtVersion; + + src = fetchFromGitHub { + owner = "gwtProject"; + repo = "tools"; + rev = "87db1e01191902be60cb12745a6267ae86de540a"; + sha256 = "sha256-y+2j0YucfxTPZmzXrdpWv2ui9ISEXzzIoKgj9JTWo5o="; + }; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp -r $src/* $out/ + + runHook postInstall + ''; + + meta = { + description = "Toolchain for building GWT ${gwtVersion}"; + homepage = "https://github.com/gwtProject/tools"; + license = lib.licenses.asl20; + }; +} diff --git a/.devenv/flake.lock b/.devenv/flake.lock new file mode 100644 index 000000000..ace5b6ce9 --- /dev/null +++ b/.devenv/flake.lock @@ -0,0 +1,127 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1726560853, + "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gwt-packages": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1, + "narHash": "sha256-jYKxibbtHSHYQ+QA0tpavDYZbTixg5xHAarOft+/EAE=", + "path": "./dist", + "type": "path" + }, + "original": { + "path": "./dist", + "type": "path" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1722062969, + "narHash": "sha256-QOS0ykELUmPbrrUGmegAUlpmUFznDQeR4q7rFhl8eQg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "b73c2221a46c13557b1b3be9c2070cc42cf01eb3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1728492678, + "narHash": "sha256-9UTxR8eukdg+XZeHgxW5hQA9fIKHsKCdOIUycTryeVw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5633bcff0c6162b9e4b5f1264264611e950c8ec7", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "gwt-packages": "gwt-packages", + "nixpkgs": "nixpkgs_2" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/.devenv/flake.nix b/.devenv/flake.nix new file mode 100644 index 000000000..fed891d71 --- /dev/null +++ b/.devenv/flake.nix @@ -0,0 +1,111 @@ +{ + description = "GWT devenv environment providing JDK 17 and Apache Ant"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + gwt-packages.url = "path:./dist"; + }; + + outputs = { self, nixpkgs, flake-utils, gwt-packages }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + # scripts + computeGwtVersion = pkgs.writeScriptBin "nix-gwt-version" (builtins.readFile ./gwt-version.sh); + computeGitRev = pkgs.writeScriptBin "nix-git-rev" (builtins.readFile ./git-rev.sh); + buildGwtPackage = pkgs.writeScriptBin "nix-build-gwt" (builtins.readFile ./build-gwt.sh); + pushGwtPackage = pkgs.writeScriptBin "nix-push-gwt" (builtins.readFile ./push-gwt.sh); + shellHookScript = pkgs.writeTextFile { + name = "nix-shell-hook.rc"; + text = builtins.readFile ./shell-hook.sh; + }; + + # Github Token + defaultGithubToken = ""; + githubToken = builtins.getEnv "GITHUB_TOKEN"; + effectiveGithubToken = if githubToken != "" then githubToken else defaultGithubToken; + + # GH Token + ghToken = builtins.getEnv "GH_TOKEN"; + effectiveGhToken = if ghToken != "" then ghToken else effectiveGithubToken; + + # Cachix authentication token + defaultCachixAuthToken = ""; + cachixAuthToken = builtins.getEnv "CACHIX_AUTH_TOKEN"; + effectiveCachixAuthToken = if cachixAuthToken != "" then cachixAuthToken else defaultCachixAuthToken; + + + # GWT version + defaultGwtVersion = "0.0.0-dev"; + gwtVersion = builtins.getEnv "GWT_VERSION"; + effectiveGwtVersion = if gwtVersion != "" then gwtVersion else defaultGwtVersion; + + # Git rev + defaultGitRev = "0000000"; + gitRev = builtins.getEnv "GIT_REV"; + effectiveGitRev = if gitRev != "" then gitRev else defaultGitRev; + + # packages + gwtTools = pkgs.callPackage ./dist/tools.nix { + gwtVersion = effectiveGwtVersion; + }; + gwt = pkgs.callPackage ./dist/gwt.nix { + inherit gwtTools; + gwtVersion = effectiveGwtVersion; + gitRev = effectiveGitRev; + jdk17 = pkgs.jdk17; + }; + + # shells + mkDevShell = pkgs.mkShell { + buildInputs = with pkgs; [ + cachix + jdk17 + ant + maven + yq-go + git + gh + unixtools.column + gwtTools + computeGwtVersion + computeGitRev + buildGwtPackage + pushGwtPackage + shellHookScript + ]; + + shellHook = '' + cat </dev/null 2>&1 && + git rev-parse --short HEAD 2>/dev/null || echo "0000000" diff --git a/.devenv/gwt-version.sh b/.devenv/gwt-version.sh new file mode 100755 index 000000000..cfc9d2a2f --- /dev/null +++ b/.devenv/gwt-version.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env -S bash -ex -o pipefail + +process_branch_name() { + local BRANCH_NAME=$1 + local PR_BASE_REF=$2 # Add this parameter for pull request base branch + + # Check if it's a pull request + if [[ -n "$PR_BASE_REF" ]]; then + # Use the base branch of the pull request + BRANCH_NAME=$PR_BASE_REF + fi + + case "$BRANCH_NAME" in + main-nuxeo) + echo "0.0.0-nuxeo" + ;; + *-nuxeo | *-test) + echo "${BRANCH_NAME}" + ;; + *) + echo "Unsupported branch name: $BRANCH_NAME" >&2 + return 1 + ;; + esac +} + +# Always try to get the current Git branch first +if BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD 2>/dev/null); then + if [[ "$BRANCH_NAME" != "HEAD" ]]; then + process_branch_name "$BRANCH_NAME" + exit 0 + fi +fi + +# Fall back to GITHUB_REF if we couldn't get the branch from Git +if [ -n "$GITHUB_REF" ]; then + case $GITHUB_REF in + refs/tags/*) + echo "${GITHUB_REF#refs/tags/}" + ;; + refs/heads/*) + process_branch_name "${GITHUB_REF#refs/heads/}" + ;; + *) + echo "Unsupported GITHUB_REF: $GITHUB_REF" >&2 + exit 1 + ;; + esac +else + echo "Unable to determine version: no Git branch and no GITHUB_REF" >&2 + exit 1 +fi diff --git a/.devenv/push-gwt.sh b/.devenv/push-gwt.sh new file mode 100644 index 000000000..ca64c433f --- /dev/null +++ b/.devenv/push-gwt.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env -S bash -e -o pipefail + +root=$(git rev-parse --show-toplevel 2>/dev/null) +if [ -z "$root" ]; then + echo "Error: Not in a Git repository" >&2 + exit 1 +fi + +current_dir=$(pwd) +if [[ "$current_dir" != "$root"* ]]; then + echo "Error: Current directory is not within the Git worktree" >&2 + exit 1 +fi + +if [ ! -d "${root}/.devenv" ]; then + echo "Error: .devenv directory not found in Git root" >&2 + exit 1 +fi + +if [ -z "$GWT_VERSION" ]; then + echo "Error: GWT_VERSION is not set" >&2 + exit 1 +fi + +if [ -z "$GWT_DIST_FILE" ] || [ ! -r "$GWT_DIST_FILE" ]; then + # Find the freshest GWT distribution ZIP file + zips=("${root}/.devenv/dist/result"/gwt-*.zip) + zip="${zips[-1]}" # Get the last (alphabetically last, which is typically the newest) file + + if [ -z "$zip" ]; then + echo "Error: GWT distribution ZIP file not found, run 'nix-build-gwt'." >&2 + exit 1 + fi + export GWT_DIST_FILE=$zip +fi + +echo "Using GWT distribution file: $GWT_DIST_FILE" + +# Run the push-gwtproject.sh script in non-interactive mode +exec "${root}/maven/push-gwtproject.sh" "${@}" < /dev/null diff --git a/.devenv/shell-hook.sh b/.devenv/shell-hook.sh new file mode 100644 index 000000000..6ec6c84b7 --- /dev/null +++ b/.devenv/shell-hook.sh @@ -0,0 +1,25 @@ +set -ax +[[ -n "${NIX_GITHUB_TOKEN:-}" ]] && + GITHUB_TOKEN="${NIX_GITHUB_TOKEN}" +[[ -n "${NIX_GITHUB_TOKEN:-}" ]] && + GH_TOKEN="${NIX_GITHUB_TOKEN}" +[[ -n "${NIX_CACHIX_AUTH_TOKEN:-}" ]] && + CACHIX_AUTH_TOKEN="${NIX_CACHIX_AUTH_TOKEN}" +GWT_VERSION=$( [[ -d .git ]] && nix-gwt-version || echo "${NIX_GWT_VERSION:-}" ) +GWT_TOOLS="${NIX_GWT_TOOLS:-}" +GIT_REV=$( [[ -d .git ]] && nix-git-rev || echo "${NIX_GIT_REV:-}" ) +set +ax + +if [ -z "${CACHIX_AUTH_TOKEN:-}" ]; then + echo "Warning: CACHIX_AUTH_TOKEN is not set. Cachix may not work correctly for private caches." +else + cachix use gwt-nuxeo +fi + +cat <' > ~/.m2/settings.xml + fi + + : Merge the new server into the existing settings + yq -p=yaml -o=xml ea '. as $item ireduce ({}; . *+ $item)' \ + <( yq -o=yaml -p=xml ~/.m2/settings.xml ) \ + <( yq -o=yaml -p=yaml --no-colors eval '{ "settings": { "servers": { "server": . } } }' <( echo "$MAVEN_SERVER_CONFIG" ) ) > ~/.m2/settings.xml.tmp + mv ~/.m2/settings.xml.tmp ~/.m2/settings.xml + + : Export the server configuration as environment variables + set -a + source <( yq -o=shell -p=yaml eval 'with_entries(select(.key == "id" or .key == "url") | {"key": "GWT_MAVEN_REPO_" + .key | upcase, "value": .value})' <<<"$MAVEN_SERVER_CONFIG" ) + set +a + + : Push the artifacts + nix-push-gwt + shell: nix develop .devenv -c bash -xe -o pipefail {0} diff --git a/.github/actions/nix-develop/action.yml b/.github/actions/nix-develop/action.yml new file mode 100644 index 000000000..68a3db9d7 --- /dev/null +++ b/.github/actions/nix-develop/action.yml @@ -0,0 +1,42 @@ +name: 'Setup GWT Dev Environment' +description: 'Checks out GWT and GWT Tools, sets up Nix and Cachix' +inputs: + cachix-auth-token: + description: 'Cachix auth token' + required: true + github-token: + description: 'Github token' + required: true +runs: + using: "composite" + steps: + - name: Prepare Nix environment + id: setenv + run: | + : check for nix backup file + set -ex -o pipefail + cat < /dev/null && echo 'true' || echo 'false' ) + ~ + shell: /usr/bin/bash -ex -o pipefail {0} + + - name: Exit if branch exists + if: steps.check_branch.outputs.exists == 'true' + run: | + cat <<~ + Error: Release branches already exists. + + Please delete the following branches before running this workflow again: + + $ git push origin :$NUXEO_RELEASE_BRANCH + $ git push origin :$NUXEO_PRERELEASE_BRANCH + ~ + exit 1 + shell: /usr/bin/bash -ex -o pipefail {0} + + - name: Enable tmate session + if: runner.debug + uses: mxschmitt/action-tmate@v3 + with: + detached: true + + - name: Set up Nix Development Environment + uses: ./.github/actions/nix-develop + with: + cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Create release branches and apply Nuxeo changes + run: | + git config user.name github-actions + git config user.email github-actions@github.com + + : Check if upstream remote exists, if not add it + if ! git remote | grep -q '^upstream$'; then + git remote add upstream https://github.com/gwtproject/gwt.git + fi + + : Fetch the upstream and get the last common commit + git fetch upstream main + git fetch upstream tag $GWT_VERSION + + COMMON_ANCESTOR=$(git merge-base HEAD upstream/main) + + : Create and push the release branch based on the GWT version tag + git checkout -b $NUXEO_RELEASE_BRANCH $GWT_VERSION + git push -f origin $NUXEO_RELEASE_BRANCH + + : Cherry-pick patch branch commits and push it + git checkout -b $NUXEO_PRERELEASE_BRANCH $NUXEO_RELEASE_BRANCH + + : Create and apply patch, then create commit message + if git diff ${COMMON_ANCESTOR}..nuxeo/main | + tee >(git apply --quiet --whitespace=fix) >(grep -q .) > /dev/null; then + SQUASH_MSG=$(cat <