1
Fork 0

display link to the last commit

This commit is contained in:
Robin Moser 2021-04-20 18:14:52 +02:00
parent 007d278435
commit b8eeb24586
No known key found for this signature in database
GPG Key ID: 7544FB5D4BE0AE8E
4 changed files with 23 additions and 3 deletions

View File

@ -70,6 +70,7 @@ jobs:
--cache-from "type=local,src=/tmp/.buildx-cache" \ --cache-from "type=local,src=/tmp/.buildx-cache" \
--cache-to "type=local,dest=/tmp/.buildx-cache" \ --cache-to "type=local,dest=/tmp/.buildx-cache" \
--build-arg VERSION=${VERSION} \ --build-arg VERSION=${VERSION} \
--build-arg COMMIT_SHA=${GITHUB_SHA} \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \ --build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ') \
--build-arg VCS_REF=${GITHUB_SHA::8} \ --build-arg VCS_REF=${GITHUB_SHA::8} \
${TAG} --file Dockerfile . ${TAG} --file Dockerfile .

View File

@ -14,6 +14,9 @@ ENV VERSION=${VERSION:-undefined}
ARG BUILD_DATE ARG BUILD_DATE
ENV BUILD_DATE=${BUILD_DATE:-undefined} ENV BUILD_DATE=${BUILD_DATE:-undefined}
ARG COMMIT_SHA
ENV COMMIT_SHA=${COMMIT_SHA:-}
RUN mkdir -p /app RUN mkdir -p /app
WORKDIR /app WORKDIR /app

View File

@ -12,7 +12,7 @@ const bs = browserSync.create()
const production = process.env.NODE_ENV == 'production' const production = process.env.NODE_ENV == 'production'
const watchMode = process.argv[2] == 'watch' const watchMode = process.argv[2] == 'watch'
const ENVIRONMENT_VARIABLES = ['NODE_ENV', 'PHOTOVIEW_API_ENDPOINT', 'VERSION', 'BUILD_DATE'] const ENVIRONMENT_VARIABLES = ['NODE_ENV', 'PHOTOVIEW_API_ENDPOINT', 'VERSION', 'BUILD_DATE', 'COMMIT_SHA']
const defineEnv = ENVIRONMENT_VARIABLES.reduce((acc, key) => { const defineEnv = ENVIRONMENT_VARIABLES.reduce((acc, key) => {
acc[`process.env.${key}`] = process.env[key] ? `"${process.env[key]}"` : null acc[`process.env.${key}`] = process.env[key] ? `"${process.env[key]}"` : null

View File

@ -1,4 +1,4 @@
import React from 'react' import React, { ReactElement } from 'react'
import styled from 'styled-components' import styled from 'styled-components'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import { import {
@ -10,6 +10,20 @@ import {
const VERSION = process.env.VERSION ? process.env.VERSION : 'undefined' const VERSION = process.env.VERSION ? process.env.VERSION : 'undefined'
const BUILD_DATE = process.env.BUILD_DATE ? process.env.BUILD_DATE : 'undefined' const BUILD_DATE = process.env.BUILD_DATE ? process.env.BUILD_DATE : 'undefined'
const COMMIT_SHA = process.env.COMMIT_SHA
let commitLink: ReactElement
if (COMMIT_SHA) {
commitLink = React.createElement(
'a',
{
href: 'https://github.com/photoview/photoview/commit/' + COMMIT_SHA,
title: COMMIT_SHA,
},
COMMIT_SHA.substring(0, 8)
)
}
const VersionInfoWrapper = styled.div` const VersionInfoWrapper = styled.div`
margin-bottom: 24px; margin-bottom: 24px;
` `
@ -25,7 +39,9 @@ const VersionInfo = () => {
<InputLabelTitle> <InputLabelTitle>
{t('settings.version_info.version_title', 'Release Version')} {t('settings.version_info.version_title', 'Release Version')}
</InputLabelTitle> </InputLabelTitle>
<InputLabelDescription>{VERSION}</InputLabelDescription> <InputLabelDescription>
{VERSION} ({commitLink})
</InputLabelDescription>
<InputLabelTitle> <InputLabelTitle>
{t('settings.version_info.build_date_title', 'Build date')} {t('settings.version_info.build_date_title', 'Build date')}
</InputLabelTitle> </InputLabelTitle>