summary refs log tree commit diff
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2023-04-03 19:21:28 +0200
committerRory& <root@rory.gay>2024-06-05 15:52:38 +0200
commit8a7102e91afe4da035346ff0fe592e40e15f3d46 (patch)
tree0b72add9e9e7ec70372e66e47a4f816783c9fdbc
parentMove auto redeploy to script (diff)
downloadSpacebar-Open-Infrastructure-8a7102e91afe4da035346ff0fe592e40e15f3d46.tar.xz
Add pkg ref for git
-rw-r--r--modules/auto-redeploy.nix15
1 files changed, 7 insertions, 8 deletions
diff --git a/modules/auto-redeploy.nix b/modules/auto-redeploy.nix
index 3e93d06..4b2a640 100644
--- a/modules/auto-redeploy.nix
+++ b/modules/auto-redeploy.nix
@@ -21,26 +21,25 @@
               ${pkgs.curl}/bin/curl -S -H "Content-Type: application/json" -d '{"username": "${config.networking.hostName} - redeploy", "content": "System started redeploy."}' ${secrets.webhooks.discord.deploy}
               cd /Spacebar-Open-Architecture
               #store current commit hash
-              echo "Current commit: $(git rev-parse HEAD)"
-              currentCommit=$(git rev-parse HEAD)
-              git fetch --all
+              echo "Current commit: $(${pkgs.git}/bin/git rev-parse HEAD)"
+              currentCommit=$(${pkgs.git}/bin/git rev-parse HEAD)
+              ${pkgs.git}/bin/git fetch --all
               #check if there are any new commits
               echo "Checking for new commits..."
-              echo "Local: $(git rev-parse HEAD)"
-              echo "Remote: $(git rev-parse @{u})"
-              if [ $(git rev-parse HEAD) = $(git rev-parse @{u}) ]; then
+              echo "Local: $(${pkgs.git}/bin/git rev-parse HEAD)"
+              echo "Remote: $(${pkgs.git}/bin/git rev-parse @{u})"
+              if [ $(${pkgs.git}/bin/git rev-parse HEAD) = $(${pkgs.git}/bin/git rev-parse @{u}) ]; then
                 echo "Already up-to-date"
                 exit 0
               fi
               #pull new commits
-              git pull
+              ${pkgs.git}/bin/git pull
               #send commit log to discord
               ${pkgs.curl}/bin/curl -S -H "Content-Type: application/json" -d '{"username": "${config.networking.hostName} - redeploy", "content": "```$(git log --pretty=format:"%h - %s" $currentCommit..HEAD)```"}' ${secrets.webhooks.discord.deploy}
               #call ./update.sh and store output (including stderr) in a file
               ./update.sh 2>&1 | tee /tmp/update.log
               #send the output to discord as a file
               ${pkgs.curl}/bin/curl -S -F "file=@/tmp/update.log" -F "filename=update.log" -F "content=System finished redeploy." -H "Content-Type: multipart/form-data" ${secrets.webhooks.discord.deploy}
-              
               '';
             #Restart = "always";
             #RestartSec = 60;