mirror of
https://github.com/hpware/news-analyze.git
synced 2025-06-23 07:41:02 +08:00
Add version tag system, for matching if the deployment is the newest one
or not.
This commit is contained in:
parent
61de16e285
commit
dd39bc3910
@ -14,7 +14,7 @@
|
||||
|
||||
# Copy source files
|
||||
COPY . .
|
||||
|
||||
RUN bun run generateVersionTag
|
||||
# Build the application
|
||||
RUN bun run build
|
||||
|
||||
|
@ -10,6 +10,7 @@ import {
|
||||
DialogTitle,
|
||||
DialogTrigger,
|
||||
} from "@/components/ui/dialog";
|
||||
import getVersionTag from "~/versionTag";
|
||||
import { Button } from "@/components/ui/button";
|
||||
const { t, locale } = useI18n();
|
||||
const user = ref("");
|
||||
@ -294,7 +295,7 @@ const submitChangeAction = async (action: string) => {
|
||||
</div>
|
||||
<hr />
|
||||
<div class="justiy-center align-center text-center">
|
||||
{{ t("app.settings") }} v0.0.3
|
||||
{{ t("app.settings") }} v0.0.3 || Version: {{ getVersionTag() }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -14,7 +14,8 @@
|
||||
"docs:dev": "vitepress dev docs",
|
||||
"docs:build": "vitepress build docs",
|
||||
"docs:preview": "vitepress preview docs",
|
||||
"wipedev": "./clean-dev-env.sh"
|
||||
"wipedev": "./clean-dev-env.sh",
|
||||
"generateVersionTag": "bun run versionTagGenerate.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@fontsource-variable/noto-sans-tc": "^5.2.5",
|
||||
|
3
versionTag.ts
Normal file
3
versionTag.ts
Normal file
@ -0,0 +1,3 @@
|
||||
export default function versionTag() {
|
||||
return "value";
|
||||
}
|
16
versionTagGenerate.ts
Normal file
16
versionTagGenerate.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { $ } from "bun";
|
||||
const characters =
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
function generateVersionTag() {
|
||||
let slug = "";
|
||||
let length = 8;
|
||||
for (let times = 0; times < length; times++) {
|
||||
slug += characters.charAt(Math.floor(Math.random() * characters.length));
|
||||
}
|
||||
return slug;
|
||||
}
|
||||
const tag = generateVersionTag();
|
||||
// Command
|
||||
await $`echo 'export default function versionTag() {return "${tag}";}' > ./versionTag.ts`;
|
||||
|
||||
console.log("Version Tag:", tag);
|
Loading…
x
Reference in New Issue
Block a user