From d8bbc6f41c7ae85c2f31236b75c8c3ac76894789 Mon Sep 17 00:00:00 2001 From: Baoshuo Date: Wed, 21 Sep 2022 13:27:01 +0800 Subject: [PATCH] feat: display s2oj version --- .drone.yml | 7 ++++++- .github/workflows/build.yml | 4 ++++ web/app/.default-config.php | 3 ++- web/app/views/page-footer.php | 14 ++++++++------ 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.drone.yml b/.drone.yml index 58428fd..b4356d4 100644 --- a/.drone.yml +++ b/.drone.yml @@ -57,7 +57,12 @@ steps: - name: tags image: alpine commands: - - echo -n "latest, $DRONE_BRANCH, ${DRONE_COMMIT_SHA:0:8}" > .tags + - echo -n "latest, $DRONE_BRANCH, ${DRONE_COMMIT_SHA:0:7}" > .tags + + - name: version + image: alpine + commands: + - sed -i "s/'s2oj-version' => 'dev'/'s2oj-version' => '${DRONE_COMMIT_SHA:0:7}'/g" web/app/.default-config.php - name: docker image: plugins/docker diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5951d3c..c8034ef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -99,6 +99,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 + - name: Replace version + run: | + sed -i "s/'s2oj-version' => 'dev'/'s2oj-version' => '$(echo "${{ github.sha }}" | cut -c1-7)'/g" web/app/.default-config.php + - name: Log in to the Container registry uses: docker/login-action@v2.0.0 with: diff --git a/web/app/.default-config.php b/web/app/.default-config.php index 74d4768..bc50183 100644 --- a/web/app/.default-config.php +++ b/web/app/.default-config.php @@ -6,7 +6,8 @@ return [ 'administrator' => 'root', 'admin-email' => 'admin@sjzezoj.com', 'QQ-group' => '', - 'ICP-license' => '冀ICP备2020028886号' + 'ICP-license' => '冀ICP备2020028886号', + 's2oj-version' => 'dev' ], 'database' => [ 'database' => 'app_uoj233', diff --git a/web/app/views/page-footer.php b/web/app/views/page-footer.php index 5930540..261dbf6 100644 --- a/web/app/views/page-footer.php +++ b/web/app/views/page-footer.php @@ -15,12 +15,14 @@ English - - - -

- -

: |

+ +

:

+

+ ">S2OJ () + + | + +