Skip to content

Commit 6c7cbcc

Browse files
committed
inject frontend version
1 parent 73acef7 commit 6c7cbcc

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ jobs:
2020
- name: Build Frontend
2121
working-directory: ./web
2222
run: npm i -g yarn && yarn && yarn build
23+
env:
24+
FRONTEND_VERSION: '${{ github.ref_name }}'
2325

2426
- name: Collect Artifacts
2527
run: tar -czf frontend.tar.gz ./web/dist/* ./web/static/index.html

web/src/StatusPage/Component.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,17 @@ function ComponentVersions() {
7575
<h2>Component Versions</h2>
7676
<table><tbody>
7777
<tr>
78-
<td><b>MPD Version:</b></td>
79-
<td>{vResult(mpdVersion, d=>d.version)}</td>
78+
<td><b>Frontend Version:</b></td>
79+
<td>{__VERSION__}</td>
8080
</tr>
8181
<tr>
8282
<td><b>Proxy Version:</b></td>
8383
<td>{vResult(proxyVersion, d=>d.version)}</td>
8484
</tr>
85+
<tr>
86+
<td><b>MPD Version:</b></td>
87+
<td>{vResult(mpdVersion, d=>d.version)}</td>
88+
</tr>
8589
</tbody></table>
8690
</>
8791
}

web/webpack.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
const TerserPlugin = require("terser-webpack-plugin");
22
const path = require("path");
3+
const { DefinePlugin } = require("webpack");
4+
35

46
module.exports = {
57
entry: "./src/index.js",
@@ -10,6 +12,13 @@ module.exports = {
1012
optimization: {
1113
minimizer: [new TerserPlugin()],
1214
},
15+
plugins: [
16+
new DefinePlugin({
17+
__VERSION__: JSON.stringify(
18+
process.env.FRONTEND_VERSION || "dev"
19+
),
20+
}),
21+
],
1322
module: {
1423
rules: [
1524
{

0 commit comments

Comments
 (0)