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 v0.2.2 #12

Merged
merged 3 commits into from
Dec 24, 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
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.2.2] - 2023-12-24

### Fixed

- Fixed release version ordering.

## [0.2.1] - 2023-12-24

### Fixed
Expand Down Expand Up @@ -37,7 +43,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

- Initial release.

[Unreleased]: https://github.com/refinedmods/refinedsites/compare/v0.2.1...HEAD
[Unreleased]: https://github.com/refinedmods/refinedsites/compare/v0.2.2...HEAD

[0.2.2]: https://github.com/refinedmods/refinedsites/compare/v0.2.1...v0.2.2

[0.2.1]: https://github.com/refinedmods/refinedsites/compare/v0.2.0...v0.2.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

@Builder
@Getter
@ToString(exclude = "pagesPath")
public class Component {
private final String name;
private final boolean root;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/com/refinedmods/refinedsites/model/Site.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@

import com.vdurmont.semver4j.Semver;
import lombok.Getter;
import lombok.ToString;

@ToString(exclude = "componentsByName")
public class Site {
@Getter
private final String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.util.stream.Stream;

import com.vdurmont.semver4j.Semver;
import com.vdurmont.semver4j.SemverException;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
Expand All @@ -38,28 +37,22 @@ class GithubComponentFactory implements ComponentFactory {
log.warn("Ignoring tag {}", tagName);
continue;
}
final Semver version;
try {
version = new Semver(tagName.substring(1));
} catch (SemverException e) {
log.warn("Invalid semver version detected {}", tagName.substring(1), e);
continue;
}
final Semver version = new Semver(tagName.substring(1));
if (version.isGreaterThanOrEqualTo(minVersion)) {
log.info("Found valid version {}", version);
validTags.add(new Tag(
tagName,
version.getValue(),
"v" + version.getValue(),
false
tagName,
version.getValue(),
"v" + version.getValue(),
false
));
}
}
validTags.add(new Tag(
config.getSnapshotBranch(),
"snapshot",
"snapshot",
true
config.getSnapshotBranch(),
"snapshot",
"snapshot",
true
));
} catch (IOException e) {
throw new RuntimeException(e);
Expand All @@ -74,23 +67,23 @@ public Stream<Component> getComponents() {
log.info("Cloning version {} into {}", validTag, path);
try {
Git.cloneRepository()
.setURI(repo.getHtmlUrl().toString())
.setDirectory(rootPath.resolve(path).toFile())
.setBranch(validTag.tagName())
.setDepth(1)
.call();
.setURI(repo.getHtmlUrl().toString())
.setDirectory(rootPath.resolve(path).toFile())
.setBranch(validTag.tagName())
.setDepth(1)
.call();
} catch (GitAPIException e) {
throw new RuntimeException(e);
}
final LocalComponentFactory factory = new LocalComponentFactory(
rootPath.resolve(path),
name,
false,
new Version(
validTag.version,
validTag.friendlyVersion,
validTag.snapshot
)
rootPath.resolve(path),
name,
false,
new Version(
validTag.version,
validTag.friendlyVersion,
validTag.snapshot
)
);
components.addAll(factory.getComponents().toList());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
Expand All @@ -27,6 +26,7 @@

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.vdurmont.semver4j.Semver;
import lombok.AllArgsConstructor;

@AllArgsConstructor
Expand Down Expand Up @@ -85,7 +85,11 @@ private Releases getReleases(final String componentName, final ReleaseConfig rel
final List<Release> releases = sourceDataByName.entrySet()
.stream()
.map(entry -> new Release(entry.getKey(), entry.getValue()))
.sorted(Comparator.comparing(Release::getCreatedAt))
.sorted((a, b) -> {
final Semver sa = new Semver(a.getName().substring(1));
final Semver sb = new Semver(b.getName().substring(1));
return sa.compareTo(sb);
})
.toList();
return new Releases(indexedAt, releases, componentName, Stats.of(sourceData));
}
Expand Down
Loading