aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel A. Giovanini <mail@gabrielgio.me>2022-07-22 15:57:59 +0200
committerGabriel A. Giovanini <mail@gabrielgio.me>2022-07-22 15:57:59 +0200
commitc430ebff167dcfc073c1c6a3375d6284936218a7 (patch)
tree7b1d1f43b25aa1ddb3a52683e20671881b3b5e36
parent1e984fc8ced6a5915dbd7b6e17bd942e8438cf27 (diff)
downloadmdir-c430ebff167dcfc073c1c6a3375d6284936218a7.tar.gz
mdir-c430ebff167dcfc073c1c6a3375d6284936218a7.tar.bz2
mdir-c430ebff167dcfc073c1c6a3375d6284936218a7.zip
feat: Add build pieces
Adding pieces to be able to later build to alpine
-rw-r--r--Makefile7
-rw-r--r--build.yml27
-rw-r--r--main.go5
3 files changed, 39 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..43e0f57
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,7 @@
+VERSION=v0.1.0
+
+build:
+ go build -ldflags="-X 'main.Version=${VERSION}'"
+
+tar: build
+ XZ_OPT=-9 tar -cvf midr-${VERSION}.tar.xz midr templates/
diff --git a/build.yml b/build.yml
new file mode 100644
index 0000000..3bb5c8e
--- /dev/null
+++ b/build.yml
@@ -0,0 +1,27 @@
+# this build is meant to be submitted manually
+image: fedora/36
+packages:
+ - rsync
+ - make
+ - go
+
+sources:
+ - https://git.sr.ht/~gabrielgio/midr
+
+secrets:
+ - 008c4f67-b864-47f8-9790-cd32f2ae8516
+
+environment:
+ deploy: builds@gabrielgio.me
+ target: artifacts.gabrielgio.me/midr
+
+tasks:
+ - build: |
+ cd midr
+ make tar
+ - deploy: |
+ cd jnfilter
+ sshopts="ssh -o StrictHostKeyChecking=no"
+ rsync --rsh="$sshopts" -rP *.tar.xz $deploy:/var/www/$target
+
+
diff --git a/main.go b/main.go
index d5fc719..d47424f 100644
--- a/main.go
+++ b/main.go
@@ -1,11 +1,16 @@
package main
import (
+ "fmt"
+
"git.sr.ht/~gabrielgio/midr/db"
"git.sr.ht/~gabrielgio/midr/routes"
)
+var Version = "development"
+
func main() {
+ fmt.Println("Version:\t", Version)
db.ConnectDb()
routes.HandleRequests()
}