Skip to content

Commit

Permalink
Update Release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Oct 16, 2024
1 parent 7cd9cb3 commit af318c4
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions patches/UpdateReleaseWorkflow.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,32 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.StandardCopyOption;
import java.util.stream.Stream;

public class UpdateReleaseWorkflow {

public static void main(String... args) throws Exception {
// Update the release workflow
Path releaseWorkflow = Path.of(".github/workflows/release.yml");
Path preRelease = Path.of(".github/workflows/pre-release.yml");
Path releasePrepare = Path.of(".github/workflows/release-perform.yml");
Path releasePerform = Path.of(".github/workflows/release-prepare.yml");
if (Files.deleteIfExists(releaseWorkflow)) {
Files.copy(Path.of("/Users/ggastald/workspace/quarkiverse/quarkus-jgit/.github/workflows/pre-release.yml"), preRelease, StandardCopyOption.REPLACE_EXISTING);
Files.copy(Path.of("/Users/ggastald/workspace/quarkiverse/quarkus-jgit/.github/workflows/release-prepare.yml"), releasePrepare);
Files.copy(Path.of("/Users/ggastald/workspace/quarkiverse/quarkus-jgit/.github/workflows/release-perform.yml"), releasePerform);
Path releasePrepare = Path.of(".github/workflows/release-prepare.yml");
Path releasePerform = Path.of(".github/workflows/release-perform.yml");
if (Files.exists(releasePrepare) && Files.exists(releasePerform)) {
try (Stream<String> lines = Files.lines(releasePerform)) {
if (lines.anyMatch(line -> line.startsWith("name: Quarkiverse Prepare Release"))) {
// The file names are wrong here, we need to fix them
Path tmpFile = Files.createTempFile("tmp", ".yml");
Files.move(releasePrepare, tmpFile, StandardCopyOption.REPLACE_EXISTING);
Files.move(releasePerform, releasePrepare, StandardCopyOption.REPLACE_EXISTING);
Files.move(tmpFile, releasePerform, StandardCopyOption.REPLACE_EXISTING);
}
}
} else {
// Path preRelease = Path.of(".github/workflows/pre-release.yml");
// Path release = Path.of(".github/workflows/release.yml");
// if (Files.deleteIfExists(releaseWorkflow)) {
// Files.copy(Path.of("/Users/ggastald/workspace/quarkiverse/quarkus-jgit/.github/workflows/pre-release.yml"), preRelease, StandardCopyOption.REPLACE_EXISTING);
// Files.copy(Path.of("/Users/ggastald/workspace/quarkiverse/quarkus-jgit/.github/workflows/release-prepare.yml"), releasePrepare);
// Files.copy(Path.of("/Users/ggastald/workspace/quarkiverse/quarkus-jgit/.github/workflows/release-perform.yml"), releasePerform);
// }
}
}
}

0 comments on commit af318c4

Please sign in to comment.