Commit 0d573104 authored by Nikos Psaromanolakis's avatar Nikos Psaromanolakis
Browse files

Initial public release

parents
Loading
Loading
Loading
Loading
Loading
+17
Changes for .ci-settings.xml: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
  <servers>
    <server>
      <id>gitlab-maven</id>
      <configuration>
        <httpHeaders>
          <property>
            <name>Job-Token</name>
            <value>${env.CI_JOB_TOKEN}</value>
          </property>
        </httpHeaders>
      </configuration>
    </server>
  </servers>
</settings>
+43
Changes for .gitignore: 43 added lines, 0 removed lines.
Original line number Diff line number Diff line
#Maven
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
release.properties
.flattened-pom.xml

# Eclipse
.project
.classpath
.settings/
bin/

# IntelliJ
.idea
*.ipr
*.iml
*.iws

# NetBeans
nb-configuration.xml

# Visual Studio Code
.vscode
.factorypath

# OSX
.DS_Store

# Vim
*.swp
*.swo

# patch
*.orig
*.rej

# Local environment
.env

# Plugin directory
/.quarkus/cli/plugins/
+98
Changes for .gitlab-ci.yml: 98 added lines, 0 removed lines.
Original line number Diff line number Diff line
stages:
  - verify
  - prod_extract_next_release
  - prod_package
  - prod_release


default:
  image: registry.ubitech.eu/nsit/maestro-apps/maven:3.8.3-openjdk-17

variables:
  MAVEN_CLI_OPTS: "-s ${CI_PROJECT_DIR}/.ci-settings.xml --batch-mode"
  BUILD_ENV: build.env

verify_job:
  stage: verify
  script: mvn ${MAVEN_CLI_OPTS} verify
  except:
    - main

prod_extract_next_release_job:
  image: registry.ubitech.eu/nsit/maestro-apps/node:lts
  stage: prod_extract_next_release
  variables:
    GITLAB_TOKEN: $GROUP_ACCESS_TOKEN
  script:
    - DEV_RELEASE_VERSION=$(npx -y
      -p @semantic-release/commit-analyzer@9.0.2
      -p @semantic-release/git@10.0.1
      -p @semantic-release/gitlab@9.5.0
      -p @semantic-release/release-notes-generator@10.0.3
      -p @semantic-release/exec@6.0.3
      -p @semantic-release/changelog@6.0.2
      -p conventional-changelog-conventionalcommits@5.0.0
      -p semantic-release@19.0.5
      semantic-release --dry-run | grep -oP '(?<=Published release ).*' | awk '{print $1}' || echo "no-release" )
    - echo "$DEV_RELEASE_VERSION" > dev_release_version.txt
    - cat dev_release_version.txt
  artifacts:
    paths:
      - dev_release_version.txt
  only:
    - main

prod_package_job:
  stage: prod_package
  image: registry.ubitech.eu/nsit/maestro-apps/maven:3.8.3-openjdk-17
  dependencies:
    - prod_extract_next_release_job
  script:
    - DEV_RELEASE_VERSION=$(cat dev_release_version.txt)
    - echo  $DEV_RELEASE_VERSION
    - if [ "$DEV_RELEASE_VERSION" = "no-release" ]; then exit 0; fi
    - chmod +x ./mvnw
    - ./mvnw ${MAVEN_CLI_OPTS}  -q versions:set -DnewVersion=$DEV_RELEASE_VERSION
    - ./mvnw ${MAVEN_CLI_OPTS} -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec
    - ./mvnw ${MAVEN_CLI_OPTS} deploy
    - git add pom.xml
    - git status
    - git config --global user.email $GITLAB_USER_EMAIL
    - git config --global user.name $GITLAB_USER_NAME
    - |
      if git commit -m "Release $DEV_RELEASE_VERSION: Update project version [skip ci]"; then 
        git push -f "https://$GITLAB_USER_NAME:$GROUP_ACCESS_TOKEN@gitlab.ubitech.eu/maestro-v2/mdg-hypo/org.etsi.osl.hypo.api/org.etsi.osl.hypo.api.tmf.schema.git" HEAD:main
      else
        echo "No changes to commit."
      fi
  artifacts:
    paths:
      - target/**
  only:
    - main

prod_semantic_versioning_job:
  image: registry.ubitech.eu/nsit/maestro-apps/node:lts
  stage: prod_release
  variables:
    GITLAB_TOKEN: $GROUP_ACCESS_TOKEN
  before_script:
    - git pull origin HEAD
  script:
    - RELEASE_VERSION=$(npx -y
      -p @semantic-release/commit-analyzer@9.0.2
      -p @semantic-release/git@10.0.1
      -p @semantic-release/gitlab@9.5.0
      -p @semantic-release/release-notes-generator@10.0.3
      -p @semantic-release/exec@6.0.3
      -p @semantic-release/changelog@6.0.2
      -p conventional-changelog-conventionalcommits@5.0.0
      -p semantic-release@19.0.5
      semantic-release | grep -oP '(?<=Published release ).*' | awk '{print $1}' || echo "no-release" )
    - echo "$RELEASE_VERSION" > release_version.txt
    - cat release_version.txt
  artifacts:
    paths:
      - release_version.txt
  only:
    - main
+1
Changes for .mvn/wrapper/.gitignore: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
maven-wrapper.jar
+84
Changes for .mvn/wrapper/MavenWrapperDownloader.java: 84 added lines, 0 removed lines.
Original line number Diff line number Diff line
/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

import java.io.IOException;
import java.io.InputStream;
import java.net.Authenticator;
import java.net.PasswordAuthentication;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;

public final class MavenWrapperDownloader {
    private static final String WRAPPER_VERSION = "3.2.0";

    private static final boolean VERBOSE = Boolean.parseBoolean(System.getenv("MVNW_VERBOSE"));

    public static void main(String[] args) {
        log("Apache Maven Wrapper Downloader " + WRAPPER_VERSION);

        if (args.length != 2) {
            System.err.println(" - ERROR wrapperUrl or wrapperJarPath parameter missing");
            System.exit(1);
        }

        try {
            log(" - Downloader started");
            final URL wrapperUrl = new URL(args[0]);
            final String jarPath = args[1].replace("..", ""); // Sanitize path
            final Path wrapperJarPath = Paths.get(jarPath).toAbsolutePath().normalize();
            downloadFileFromURL(wrapperUrl, wrapperJarPath);
            log("Done");
        } catch (IOException e) {
            System.err.println("- Error downloading: " + e.getMessage());
            if (VERBOSE) {
                e.printStackTrace();
            }
            System.exit(1);
        }
    }

    private static void downloadFileFromURL(URL wrapperUrl, Path wrapperJarPath)
            throws IOException {
        log(" - Downloading to: " + wrapperJarPath);
        if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
            final String username = System.getenv("MVNW_USERNAME");
            final char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
            Authenticator.setDefault(new Authenticator() {
                @Override
                protected PasswordAuthentication getPasswordAuthentication() {
                    return new PasswordAuthentication(username, password);
                }
            });
        }
        try (InputStream inStream = wrapperUrl.openStream()) {
            Files.copy(inStream, wrapperJarPath, StandardCopyOption.REPLACE_EXISTING);
        }
        log(" - Downloader complete");
    }

    private static void log(String msg) {
        if (VERBOSE) {
            System.out.println(msg);
        }
    }

}
Loading