diff --git a/.github/workflows/sync-deps.yaml b/.github/workflows/sync-deps.yaml index 3428e442b..ac7a0b627 100644 --- a/.github/workflows/sync-deps.yaml +++ b/.github/workflows/sync-deps.yaml @@ -35,6 +35,7 @@ jobs: run: | M2_HOME=/home/sbtuser/.m2/repository aws s3 sync $M2_HOME s3://$BUCKET/maven --exclude '*' --include '**kiama**' - aws s3 sync $M2_HOME s3://$BUCKET/maven --exclude '*' --include '**jackson**' - aws s3 sync $M2_HOME s3://$BUCKET/maven --exclude '*' --include '**scala-logging**' - aws s3 sync $M2_HOME s3://$BUCKET/maven --exclude '*' --include '**jwt-core**' + cd deps/others + sbt createS3SyncScript + export M2_HOME BUCKET + ./s3-sync-deps.sh diff --git a/deps/others/.gitignore b/deps/others/.gitignore index 1770d7204..9a99535dc 100644 --- a/deps/others/.gitignore +++ b/deps/others/.gitignore @@ -1,2 +1,3 @@ *.jar -manifest.txt \ No newline at end of file +manifest.txt +s3-sync-deps.sh \ No newline at end of file diff --git a/deps/others/build.sbt b/deps/others/build.sbt index d4f4f90a5..b60472156 100644 --- a/deps/others/build.sbt +++ b/deps/others/build.sbt @@ -169,5 +169,28 @@ patchDependencies := { } +val createS3SyncScript = taskKey[Unit]("Create a bash script for syncing dependencies to S3") +val scriptFile = "s3-sync-deps.sh" +createS3SyncScript := { + val dependencies = libraryDependencies.value + + val writer = new BufferedWriter(new FileWriter(scriptFile)) + + try { + writer.write("#!/bin/bash\n\n") + dependencies.foreach { dep => + writer.write(s"aws s3 sync $$M2_HOME s3://$$BUCKET/maven --exclude '*' --include '**${dep.name}**'\n") + } + } finally { + // Always close the writer to release resources + writer.close() + } + + // Make the script executable + new File(scriptFile).setExecutable(true) + + // Notify that the task is completed + println(s"Bash script created: $scriptFile") +} \ No newline at end of file