ci: Add initial semantic-release configuration (#1528)

This commit is contained in:
Dermot Duffy
2024-09-14 15:47:42 -07:00
committed by GitHub
parent ed91916967
commit f944dee82c
7 changed files with 2934 additions and 38 deletions
+2 -5
View File
@@ -6,7 +6,6 @@ import { ifDefined } from 'lit/directives/if-defined.js';
import { Ref, createRef, ref } from 'lit/directives/ref.js';
import { styleMap } from 'lit/directives/style-map.js';
import 'web-dialog';
import pkg from '../package.json';
import { actionHandler } from './action-handler-directive.js';
import { ConditionsEvaluateRequestEvent } from './card-controller/conditions-manager.js';
import { CardController } from './card-controller/controller';
@@ -34,6 +33,7 @@ import { localize } from './localize/localize.js';
import cardStyle from './scss/card.scss';
import { ExtendedHomeAssistant, MediaLoadedInfo, Message } from './types.js';
import { frigateCardHasAction } from './utils/action.js';
import { getReleaseVersion } from './utils/diagnostics';
// ***************************************************************************
// General Card-Wide Notes
@@ -70,10 +70,7 @@ import { frigateCardHasAction } from './utils/action.js';
// ***************************************************************************
console.info(
`%c FRIGATE-HASS-CARD \n` +
`%c ${localize('common.version')} ` +
`${pkg.version} ` +
`${process.env.NODE_ENV === 'development' ? `(${pkg['buildDate']})` : ''}`,
`%c FRIGATE-HASS-CARD \n` + `%c ${localize('common.version')} ` + getReleaseVersion(),
'color: pink; font-weight: bold; background: black',
'color: white; font-weight: bold; background: dimgray',
);
+12 -2
View File
@@ -12,6 +12,16 @@ interface GitDiagnostics {
commit_date?: string;
}
export const getReleaseVersion = (): string => {
const releaseVersion = '__FRIGATE_CARD_RELEASE_VERSION__';
/* istanbul ignore if: this path cannot be reached during tests as the value
is substituted by rollup -- @preserve */
if ((releaseVersion as unknown) === 'dev') {
return `${releaseVersion}+${pkg['gitAbbrevHash']} (${pkg['buildDate']})`;
}
return releaseVersion;
};
export interface Diagnostics {
card_version: string;
browser: string;
@@ -51,7 +61,7 @@ export const getDiagnostics = async (
});
return {
card_version: pkg.version,
card_version: getReleaseVersion(),
browser: navigator.userAgent,
date: new Date(),
...(frigateVersionMap.size && {
@@ -60,7 +70,7 @@ export const getDiagnostics = async (
lang: getLanguage(),
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
git: {
...(pkg['gitVersion'] && { build_version: pkg['gitVersion'] }),
...(pkg['gitAbbrevHash'] && { hash: pkg['gitAbbrevHash'] }),
...(pkg['buildDate'] && { build_date: pkg['buildDate'] }),
...(pkg['gitDate'] && { commit_date: pkg['gitDate'] }),
},