Skip to content

Commit a2ce9b0

Browse files
committed
env variable for version fix
1 parent 21532d6 commit a2ce9b0

File tree

3 files changed

+3
-6
lines changed

3 files changed

+3
-6
lines changed

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Build
2626
run: dotnet run bundle
2727
env:
28-
APP_VERSION: ${{ github.ref_name }}
28+
VITE_APP_VERSION: ${{ github.ref_name }}
2929

3030
- name: Azure Login
3131
uses: azure/login@v1

src/Client/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
</script>
1616
<script type="module" src="/output/App.js"></script>
1717
<script type="module">
18-
document.title = document.title.concat(` - v${window.APP_VERSION}`)
18+
const appVersion = import.meta.env.VITE_APP_VERSION || "dev"
19+
document.title = document.title.concat(` - v${appVersion}`)
1920
</script>
2021

2122
</body>

src/Client/vite.config.mts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import react from "@vitejs/plugin-react";
33

44
const proxyPort = process.env.SERVER_PROXY_PORT || "5000";
55
const proxyTarget = "http://localhost:" + proxyPort;
6-
const appVersion = process.env.APP_VERSION || "dev"
76

87
// https://vitejs.dev/config/
98
export default defineConfig({
@@ -20,8 +19,5 @@ export default defineConfig({
2019
changeOrigin: true,
2120
}
2221
}
23-
},
24-
define: {
25-
APP_VERSION: JSON.stringify(appVersion),
2622
}
2723
});

0 commit comments

Comments
 (0)