find-stone-beer / commit
Change where results HTML is created and use this as part of pages job.
.gitignore | 4 ++-- .gitlab-ci.yml | 2 +- main.go | 7 ++++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index a6bb4d5..a633703 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -cache +cache/ __debug_bin find_stone_beer -results.html +public/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c5d7185..56cf8d8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -18,7 +18,7 @@ pages: stage: run-and-deploy script: - make run - - mv results.html public/index.html + - mv public public artifacts: paths: - public diff --git a/main.go b/main.go index f5c0d10..212defb 100644 --- a/main.go +++ b/main.go @@ -143,7 +143,12 @@ func main() { } sb.WriteString(`</body></html>`) - err = os.WriteFile("results.html", []byte(sb.String()), 0644) + outPath := "./public/index.html" + outDir := filepath.Dir(outPath) + if _, err := os.Stat(outDir); os.IsNotExist(err) { + os.MkdirAll(outDir, 0700) + } + err = os.WriteFile(outPath, []byte(sb.String()), 0644) if err != nil { panic(err) }