diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5d3dd59..261879d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -59,7 +59,10 @@ jobs: - name: Build assets run: | docker build --target base -t base . - docker run --rm -v $PWD/websh_front:/work -t base nimble build -Y + docker run --rm -v $PWD/websh_front:/work -t base \ + nimble build -Y \ + "-d:tag:${GITHUB_REF/refs?heads?}" \ + "-d:revision:$GITHUB_SHA" - name: Create artifact run: | diff --git a/docker-compose.yml b/docker-compose.yml index c27a691..2fce754 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,6 +22,8 @@ services: - build - -Y - -d:local + - -d:tag:tag + - -d:revision:rev websh_server: build: *app-build diff --git a/websh_front/src/index.nim b/websh_front/src/index.nim index 0e6efdc..9d03683 100644 --- a/websh_front/src/index.nim +++ b/websh_front/src/index.nim @@ -39,6 +39,10 @@ else: const baseUrl = "https://websh.jiro4989.com" const apiUrl = &"{baseUrl}/api/shellgei" +# コンパイル時に値を埋め込む +const tag {.strdefine.} = "v0.0.0" +const revision {.strdefine.} = "develop" + proc newMediaObj(): MediaObj = MediaObj(name: cstring"", data: cstring"") var @@ -282,6 +286,8 @@ proc createDom(): VNode = a(href = "https://github.com/jiro4989/websh"): text "Repository" text ", " a(href = "https://stats.uptimerobot.com/EZnRXc325K"): text "Public Status Page" + tdiv(class = "content has-text-centered"): + text "tag: " & tag & ", revision: " & revision when not defined modeTest: setRenderer createDom