Implemented Git version tag into docker build and GitHub actions. Implemented Release Notes button. Updated Documentation button to directly navigate to the README.md

This commit is contained in:
Glenn de Haan
2024-10-07 10:44:02 +02:00
parent eacb0b4fd9
commit 7fb9956c10
6 changed files with 19 additions and 4 deletions

View File

@@ -32,6 +32,8 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: glenndehaan/unifi-voucher-site:${{ github.ref_name }}
build-args: |
GIT_TAG=${{ github.ref_name }}
- name: Build and push (latest)
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v5
@@ -40,3 +42,5 @@ jobs:
platforms: linux/amd64,linux/arm64
push: true
tags: glenndehaan/unifi-voucher-site:latest
build-args: |
GIT_TAG=master

View File

@@ -115,3 +115,5 @@ COPY . .
# Set build
#
RUN echo -n `date '+%Y.%m.%d.%H.%M'` > /etc/unifi_voucher_site_build
ARG GIT_TAG
ENV GIT_TAG=$GIT_TAG

View File

@@ -39,9 +39,9 @@ module.exports = () => {
* Output build version
*/
if(fs.existsSync('/etc/unifi_voucher_site_build')) {
log.info(`[Version] ${fs.readFileSync('/etc/unifi_voucher_site_build', 'utf-8')}`);
log.info(`[Version] Git: ${variables.gitTag}, Build: ${fs.readFileSync('/etc/unifi_voucher_site_build', 'utf-8')}`);
} else {
log.info(`[Version] **DEVELOPMENT**`);
log.info(`[Version] Git: ${variables.gitTag}, Build: **DEVELOPMENT**`);
}
/**

View File

@@ -35,5 +35,6 @@ module.exports = {
smtpSecure: config('smtp_secure') || process.env.SMTP_SECURE || false,
smtpUsername: config('smtp_username') || process.env.SMTP_USERNAME || '',
smtpPassword: config('smtp_password') || process.env.SMTP_PASSWORD || '',
logLevel: config('log_level') || process.env.LOG_LEVEL || 'info'
logLevel: config('log_level') || process.env.LOG_LEVEL || 'info',
gitTag: process.env.GIT_TAG || 'master'
};

View File

@@ -366,6 +366,7 @@ if(variables.serviceWeb) {
res.render('voucher', {
baseUrl: req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : '',
gitTag: variables.gitTag,
user: user,
userIcon: req.oidc ? crypto.createHash('sha256').update(user.email).digest('hex') : '',
authDisabled: variables.authDisabled,
@@ -412,6 +413,7 @@ if(variables.serviceWeb) {
res.render('status', {
baseUrl: req.headers['x-ingress-path'] ? req.headers['x-ingress-path'] : '',
gitTag: variables.gitTag,
user: user,
userIcon: req.oidc ? crypto.createHash('sha256').update(user.email).digest('hex') : '',
authDisabled: variables.authDisabled,

View File

@@ -44,12 +44,18 @@
</svg>
Feature Status
</a>
<a href="https://github.com/glenndehaan/unifi-voucher-site" aria-label="GitHub Project Link" target="_blank" rel="noreferrer noopener" type="button" class="flex px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 items-center">
<a href="https://github.com/glenndehaan/unifi-voucher-site/tree/<%= gitTag %>#unifi-voucher-site" aria-label="Project Documentation Link" target="_blank" rel="noreferrer noopener" type="button" class="flex px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 items-center">
<svg class="mr-3 h-5 w-5" viewBox="0 0 42 42" fill="currentColor">
<path d="M21,0.5c-11.6,0-21,9.4-21,21c0,9.3,6,17.1,14.4,19.9c1.1,0.2,1.4-0.5,1.4-1c0-0.5,0-1.8,0-3.6C9.9,38.1,8.7,34,8.7,34c-1-2.4-2.3-3.1-2.3-3.1c-1.9-1.3,0.1-1.3,0.1-1.3c2.1,0.1,3.2,2.2,3.2,2.2c1.9,3.2,4.9,2.3,6.1,1.7c0.2-1.4,0.7-2.3,1.3-2.8c-4.7-0.5-9.6-2.3-9.6-10.4c0-2.3,0.8-4.2,2.2-5.6c-0.2-0.5-0.9-2.7,0.2-5.6c0,0,1.8-0.6,5.8,2.2c1.7-0.5,3.5-0.7,5.3-0.7c1.8,0,3.6,0.2,5.3,0.7c4-2.7,5.8-2.2,5.8-2.2c1.1,2.9,0.4,5,0.2,5.6c1.3,1.5,2.2,3.3,2.2,5.6c0,8.1-4.9,9.8-9.6,10.4c0.8,0.6,1.4,1.9,1.4,3.9c0,2.8,0,5.1,0,5.8c0,0.6,0.4,1.2,1.4,1C36,38.7,42,30.8,42,21.5C42,9.9,32.6,0.5,21,0.5z"></path>
</svg>
Documentation
</a>
<a href="https://github.com/glenndehaan/unifi-voucher-site/releases/<%= gitTag === 'master' ? 'latest' : 'tag/' + gitTag %>" aria-label="Project Release Notes Link" target="_blank" rel="noreferrer noopener" type="button" class="flex px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 items-center">
<svg class="mr-3 h-5 w-5" viewBox="0 0 24 24" fill="currentColor">
<path fill-rule="evenodd" d="M5.25 2.25a3 3 0 0 0-3 3v4.318a3 3 0 0 0 .879 2.121l9.58 9.581c.92.92 2.39 1.186 3.548.428a18.849 18.849 0 0 0 5.441-5.44c.758-1.16.492-2.629-.428-3.548l-9.58-9.581a3 3 0 0 0-2.122-.879H5.25ZM6.375 7.5a1.125 1.125 0 1 0 0-2.25 1.125 1.125 0 0 0 0 2.25Z" clip-rule="evenodd" />
</svg>
Release Notes
</a>
<% if(!authDisabled) { %>
<div class="border-t border-black/5 dark:border-white/5"></div>
<a href="<%= baseUrl %>/logout" aria-label="Logout" type="button" class="flex w-full text-left px-4 py-2 text-sm text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 items-center">