From a49793d94847adc67105d17e7dbee70ed38ffbed Mon Sep 17 00:00:00 2001
From: Volker Schukai <volker.schukai@schukai.com>
Date: Sun, 21 Apr 2024 17:53:13 +0200
Subject: [PATCH] chore: update deploy script

---
 nix/scripts/check-code.nix |  7 -------
 nix/scripts/deploy.nix     |  4 +++-
 nix/scripts/go-task.nix    | 10 ++++++----
 3 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/nix/scripts/check-code.nix b/nix/scripts/check-code.nix
index 9ed0729..1f10340 100644
--- a/nix/scripts/check-code.nix
+++ b/nix/scripts/check-code.nix
@@ -45,13 +45,6 @@ in
       exit 1
     fi
 
-    echo_step "Running go fmt"
-    if ! ${pkgs.go}/bin/go fmt .
-    then
-      echo_fail "go fmt failed"
-      exit 1
-    fi
-
     echo_step "Running go mod tidy"
     if ! ${pkgs.go}/bin/go mod tidy
     then
diff --git a/nix/scripts/deploy.nix b/nix/scripts/deploy.nix
index 01d3d2c..b3243b5 100644
--- a/nix/scripts/deploy.nix
+++ b/nix/scripts/deploy.nix
@@ -52,13 +52,15 @@ in
     ${pkgs.git}/bin/git fetch --prune --prune-tags
 
     echo_step "Bumping version"
-    gitVersion=v$(version predict --exit-code-if-no-bump)
+    gitVersion=$(version predict --exit-code-if-no-bump)
     if [ -z "$gitVersion" ]; then
         echo_ok "There is no version bump."
         echo_ok "done"
         exit 0
     fi
     
+    gitVersion="v$gitVersion"
+    
     ${pkgs.git}/bin/git tag -a $gitVersion -m"chore: bump version"
     ${pkgs.git}/bin/git --no-pager log --decorate=short --pretty=oneline -n 5
     ${pkgs.git}/bin/git push -o ci.skip origin ''${CI_COMMIT_REF_NAME} --tags
diff --git a/nix/scripts/go-task.nix b/nix/scripts/go-task.nix
index 76a71d2..a319a25 100644
--- a/nix/scripts/go-task.nix
+++ b/nix/scripts/go-task.nix
@@ -1,5 +1,7 @@
 {pkgs}: let
-  taskfile = builtins.toFile "taskfile.yml" ''
+  taskfile = pkgs.writeTextFile {
+   name = "taskfile.yml";
+   text = ''
     version: '3'
 
     tasks:
@@ -56,13 +58,13 @@
           - commit
         cmds:
           - check-code
-          - cd "{{.USER_WORKING_DIR}}" && cd $(git rev-parse --show-toplevel) && nix run git+https://gitlab.schukai.com/schukai/entwicklung/nix-flakes#git-commit --no-write-lock-file
+          - cd "{{.USER_WORKING_DIR}}" && cd $(${pkgs.git}/bin/git rev-parse --show-toplevel) && nix run git+https://gitlab.schukai.com/schukai/entwicklung/nix-flakes#git-commit --no-write-lock-file
         silent: true
         env:
           USER_WORKING_DIR: "{{.USER_WORKING_DIR}}"
-
-
   '';
+ 
+  };
 in
   pkgs.writeShellScriptBin "task" ''
     ${pkgs.go-task}/bin/task -t "${taskfile}" "$@"
-- 
GitLab