From 152e682f0c6c2c8713fcabc91e9df7f302ad9f2b Mon Sep 17 00:00:00 2001 From: Araozu Date: Sun, 27 Oct 2024 17:55:34 -0500 Subject: [PATCH] fix: attempt to use jenkins to build templ templates --- Dockerfile | 2 +- Jenkinsfile | 3 +- src/modules/album/album_templ.go | 28 +++++++------- src/modules/auth/login_templ.go | 2 +- src/modules/index/index.templ | 4 +- src/modules/index/index_templ.go | 14 +++---- src/utils/utils.templ | 4 +- src/utils/utils_templ.go | 66 ++++++++++++++++---------------- 8 files changed, 62 insertions(+), 61 deletions(-) diff --git a/Dockerfile b/Dockerfile index e6796a8..96aa56f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Start with an Alpine base image -FROM alpine:latest +FROM debian:latest # Create a directory for our application WORKDIR /app diff --git a/Jenkinsfile b/Jenkinsfile index 1258b14..978fe65 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,12 +4,13 @@ pipeline { stage('Build go binary') { agent { docker { - image 'golang:1.23-alpine' + image 'ghcr.io/a-h/templ:latest' reuseNode true } } steps { sh 'go mod tidy' + sh 'templ generate' sh 'go build main.go' } } diff --git a/src/modules/album/album_templ.go b/src/modules/album/album_templ.go index d5775e2..33b9269 100644 --- a/src/modules/album/album_templ.go +++ b/src/modules/album/album_templ.go @@ -49,7 +49,7 @@ func allAlbumsTempl(albums []utils.Album) templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

Albums


") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -60,12 +60,12 @@ func allAlbumsTempl(albums []utils.Album) templ.Component { } } if len(albums) == 0 { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

No albums found

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -107,7 +107,7 @@ func albumsFragment(albums []utils.Album) templ.Component { } } if len(albums) == 0 { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 4) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

No albums found

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -150,7 +150,7 @@ func albumTempl(albumId string, album *utils.Album, songs []utils.Song, songsJso }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 5) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -189,7 +189,7 @@ func albumTempl(albumId string, album *utils.Album, songs []utils.Song, songsJso if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 8) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -202,12 +202,12 @@ func albumTempl(albumId string, album *utils.Album, songs []utils.Song, songsJso if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 9) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for i, song := range songs { - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 10) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 14) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/src/modules/auth/login_templ.go b/src/modules/auth/login_templ.go index 1bbad50..ab86c6d 100644 --- a/src/modules/auth/login_templ.go +++ b/src/modules/auth/login_templ.go @@ -43,7 +43,7 @@ func LoginTempl() templ.Component { }() } ctx = templ.InitializeContext(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 1) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
Login to Navidrome:




Result:
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/src/modules/index/index.templ b/src/modules/index/index.templ index 892defe..c4610b2 100644 --- a/src/modules/index/index.templ +++ b/src/modules/index/index.templ @@ -13,7 +13,7 @@ templ IndexTempl(albums []utils.Album) {

Random Albums

-
+
for _, album := range albums { @AlbumCard(album) } @@ -24,7 +24,7 @@ templ IndexTempl(albums []utils.Album) { templ AlbumCard(album utils.Album) {
-
+
music to go

Random Albums

") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -56,7 +56,7 @@ func IndexTempl(albums []utils.Album) templ.Component { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 2) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -95,7 +95,7 @@ func AlbumCard(album utils.Album) templ.Component { templ_7745c5c3_Var3 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 3) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -130,7 +130,7 @@ func AlbumCard(album utils.Album) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 6) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -143,7 +143,7 @@ func AlbumCard(album utils.Album) templ.Component { if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } - templ_7745c5c3_Err = templ.WriteWatchModeString(templ_7745c5c3_Buffer, 7) + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/src/utils/utils.templ b/src/utils/utils.templ index a9426a1..25db4ec 100644 --- a/src/utils/utils.templ +++ b/src/utils/utils.templ @@ -34,7 +34,7 @@ templ MusicPlayer() { x-data="player" >
@@ -251,7 +251,7 @@ templ MusicPlayer() { templ fullMusicPlayer() {