From da09cd7edb13eab47ee42a48de7bceee44f8b322 Mon Sep 17 00:00:00 2001
From: Lars Seipel <ls@slrz.net>
Date: Wed, 7 Dec 2022 14:25:29 +0100
Subject: [PATCH] build in Gitlab CI/CD

---
 .gitlab-ci.yml | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..20ee3c5
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,18 @@
+build:
+  variables:
+    comm: nova-password
+  image: docker.io/golang:1.19
+  before_script:
+    - go mod download
+  script:
+    - |
+      for os in linux darwin; do
+        for arch in amd64 arm64; do
+          GOOS=$os GOARCH=$arch CGO_ENABLED=0 go build -o "$comm-$os-$arch" || exit 1
+          curl -H "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ./$comm-$os-$arch "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/nova-password/latest/$comm-$os-$arch" || exit 1
+        done
+      done
+      GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -o "$comm-windows-amd64.exe" || exit 1
+      curl -H "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ./$comm-windows-amd64.exe "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/nova-password/latest/$comm-windows-amd64.exe"
+  only:
+    - cicd
-- 
GitLab