package: upload output jars as build artifacts

This commit is contained in:
Max Weber
2023-01-22 13:58:33 -07:00
committed by Adam
parent 2b1a04cf30
commit bf231bf530
3 changed files with 17 additions and 0 deletions

View File

@@ -73,6 +73,12 @@ jobs:
name: manifest_diff
path: /tmp/manifest_diff
retention-days: 1
- uses: actions/upload-artifact@v3
if: ${{ github.event_name == 'pull_request' }}
with:
name: jars
path: /tmp/jars
retention-days: 1
upload:
if: (github.event_name != 'push' || github.repository_owner == 'runelite') && github.event_name != 'pull_request'
needs: build

View File

@@ -64,6 +64,7 @@ public class Packager implements Closeable
{
private static final File PLUGIN_ROOT = new File("./plugins");
public static final File PACKAGE_ROOT = new File("./package/").getAbsoluteFile();
private static final File ARTIFACT_DIR = new File("/tmp/jars");
private Semaphore apiCheckSemaphore = new Semaphore(8);
private Semaphore downloadSemaphore = new Semaphore(2);
@@ -108,6 +109,8 @@ public class Packager implements Closeable
diff.setOldManifestVersion(apiFilesVersion);
}
ARTIFACT_DIR.mkdirs();
Queue<File> buildQueue = Queues.synchronizedQueue(new ArrayDeque<>(buildList));
List<Thread> buildThreads = IntStream.range(0, 8)
.mapToObj(v ->
@@ -191,6 +194,8 @@ public class Packager implements Closeable
logURL = p.uploadLog(uploadConfig);
}
p.copyArtifacts(ARTIFACT_DIR);
diff.getAdd().add(p.getManifest());
log.info("{}: done in {}ms [{}/{}]", p.getInternalName(), p.getBuildTimeMS(), numDone.get() + 1, numTotal);

View File

@@ -944,6 +944,12 @@ public class Plugin implements Closeable
return url.toString();
}
public void copyArtifacts(File artifactDir) throws IOException
{
Files.copy(jarFile.toPath(), new File(artifactDir, getInternalName() + ".jar").toPath());
Files.copy(logFile.toPath(), new File(artifactDir, getInternalName() + ".log").toPath());
}
public void writeLog(String format, Object... args) throws IOException
{
FormattingTuple fmt = MessageFormatter.arrayFormat(format, args);