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

feat(deps)(automation): dynamic sync deps #318

Merged
merged 3 commits into from
Jan 12, 2024
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
7 changes: 4 additions & 3 deletions .github/workflows/sync-deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion deps/others/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.jar
manifest.txt
manifest.txt
s3-sync-deps.sh
23 changes: 23 additions & 0 deletions deps/others/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Loading