Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release PR #24

Merged
merged 6 commits into from
Aug 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ on:
- master

env:
RELEASE_VERSION: "0.4.22"
DEVELOP_VERSION: "0.4.23-SNAPSHOT"
RELEASE_VERSION: "0.4.23"
DEVELOP_VERSION: "0.4.24-SNAPSHOT"
GIT_AUTHOR_NAME: "@swisspost-devs"
GIT_AUTHOR_EMAIL: "oss@post.ch"
GIT_COMMITTER_NAME: "swisspost-devs"
Expand Down Expand Up @@ -39,3 +39,11 @@ jobs:
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }}
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }}
CI_GPG_PASSPHRASE: ${{ secrets.CI_GPG_PASSPHRASE }}

- name: Merge back to develop
run: |
git fetch --depth 1 origin develop
git checkout develop
git fetch --shallow-since="$(git show -s --format=%ci develop)" origin master develop
git merge master --no-edit
git push origin develop
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ protected void generatePackageJson(String version) throws IOException {
if (shortname != null && shortname.length() > 0) {
customConfig.put("shortname", shortname);
}
customConfig.put("projectName", mavenProject.getArtifactId());
customConfig.put("projectName", getProjectName());
customConfig.put("title", getTitle(apiSpec));

final List<String> plugins = new ArrayList<>();
Expand Down Expand Up @@ -351,14 +351,36 @@ private String getDescription(Map<String, Object> apiSpec) {
return (String) info.get("description");
}

private String getProjectName() {
return String.join("-", this.shortname, this.type);
}

private String getName() {
String artifactId = mavenProject.getArtifactId();
StringBuilder nameBuilder = new StringBuilder();

if (this.domain != null && this.domain.length() > 0) {
List<String> domainParts = new ArrayList<>(Arrays.asList(this.domain.split("\\.")));
Collections.reverse(domainParts);
String nodeDomain = String.join("-", domainParts);
nameBuilder.append("@").append(nodeDomain);
}

if(scope.length() == 0) {
return artifactId;
if (this.namespace != null && this.namespace.length() > 0) {
String nodeNamespace = this.namespace
.replace(".", "-")
.replace("-" + this.shortname, "");

if (nameBuilder.length() == 0) {
nameBuilder.append("@");
} else {
nameBuilder.append("-");
}
nameBuilder.append(nodeNamespace).append("/");
}

return String.format("%s/%s", this.scope.startsWith("@") ? this.scope : "@" + this.scope, artifactId);
nameBuilder.append(getProjectName());

return nameBuilder.toString();
}

protected void checkNodeInstalled() throws MojoExecutionException {
Expand Down
Loading