From 491b0ca98523d4e6561346f1df336302a66816b8 Mon Sep 17 00:00:00 2001 From: jiro Date: Thu, 26 Nov 2020 09:38:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E3=82=B3=E3=83=B3=E3=83=91=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E6=99=82=E3=81=AB=E3=82=BF=E3=82=B0=E3=81=A8=E3=82=B3?= =?UTF-8?q?=E3=83=9F=E3=83=83=E3=83=88=E3=83=8F=E3=83=83=E3=82=B7=E3=83=A5?= =?UTF-8?q?=E3=82=92=E5=9F=8B=E3=82=81=E8=BE=BC=E3=82=80=20#10=20(#195)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * コンパイル時にリビジョンとタグ番号を埋め込むように変更 * デプロイワークフロー時にタグとリビジョンを埋め込むように変更 --- .github/workflows/deploy.yml | 5 ++++- docker-compose.yml | 2 ++ websh_front/src/index.nim | 6 ++++++ 3 files changed, 12 insertions(+), 1 deletion(-) 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