add automatic app version and park git init tag from vojo/dev
This commit is contained in:
parent
cb16edbf37
commit
91e3dd95ec
8 changed files with 38 additions and 5426 deletions
8
.github/workflows/prod-deploy.yml
vendored
8
.github/workflows/prod-deploy.yml
vendored
|
|
@ -21,14 +21,6 @@ jobs:
|
||||||
package-manager-cache: false
|
package-manager-cache: false
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
- name: Run semantic release
|
|
||||||
run: npm run semantic-release
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
|
|
||||||
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
|
|
||||||
GIT_COMMITTER_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
|
|
||||||
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
|
|
||||||
- name: Get version from tag
|
- name: Get version from tag
|
||||||
id: vars
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
5348
package-lock.json
generated
5348
package-lock.json
generated
File diff suppressed because it is too large
Load diff
35
package.json
35
package.json
|
|
@ -25,8 +25,7 @@
|
||||||
"build:android:release": "npm run build && npm run android:sync && npm run android:apk:release",
|
"build:android:release": "npm run build && npm run android:sync && npm run android:apk:release",
|
||||||
"build:android:aab": "npm run build && npm run android:sync && npm run android:aab:release",
|
"build:android:aab": "npm run build && npm run android:sync && npm run android:aab:release",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"commit": "git-cz",
|
"commit": "git-cz"
|
||||||
"semantic-release": "semantic-release"
|
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"*.{ts,tsx,js,jsx}": "eslint",
|
"*.{ts,tsx,js,jsx}": "eslint",
|
||||||
|
|
@ -37,35 +36,6 @@
|
||||||
"path": "./node_modules/cz-conventional-changelog"
|
"path": "./node_modules/cz-conventional-changelog"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"release": {
|
|
||||||
"branches": [
|
|
||||||
"dev"
|
|
||||||
],
|
|
||||||
"plugins": [
|
|
||||||
"@semantic-release/commit-analyzer",
|
|
||||||
"@semantic-release/release-notes-generator",
|
|
||||||
[
|
|
||||||
"@semantic-release/exec",
|
|
||||||
{
|
|
||||||
"prepareCmd": "node scripts/update-version.js ${nextRelease.version}"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"@semantic-release/git",
|
|
||||||
{
|
|
||||||
"assets": [
|
|
||||||
"package.json",
|
|
||||||
"package-lock.json",
|
|
||||||
"src/app/features/settings/about/About.tsx",
|
|
||||||
"src/app/pages/auth/AuthFooter.tsx",
|
|
||||||
"src/app/pages/client/WelcomePage.tsx"
|
|
||||||
],
|
|
||||||
"message": "chore(release): ${nextRelease.version} [skip ci]"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"@semantic-release/github"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "Ajay Bura",
|
"author": "Ajay Bura",
|
||||||
"license": "AGPL-3.0-only",
|
"license": "AGPL-3.0-only",
|
||||||
|
|
@ -139,8 +109,6 @@
|
||||||
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
|
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
|
||||||
"@rollup/plugin-inject": "5.0.3",
|
"@rollup/plugin-inject": "5.0.3",
|
||||||
"@rollup/plugin-wasm": "6.1.1",
|
"@rollup/plugin-wasm": "6.1.1",
|
||||||
"@semantic-release/exec": "7.1.0",
|
|
||||||
"@semantic-release/git": "10.0.1",
|
|
||||||
"@types/chroma-js": "3.1.1",
|
"@types/chroma-js": "3.1.1",
|
||||||
"@types/file-saver": "2.0.5",
|
"@types/file-saver": "2.0.5",
|
||||||
"@types/is-hotkey": "0.1.10",
|
"@types/is-hotkey": "0.1.10",
|
||||||
|
|
@ -166,7 +134,6 @@
|
||||||
"husky": "9.1.7",
|
"husky": "9.1.7",
|
||||||
"lint-staged": "16.3.2",
|
"lint-staged": "16.3.2",
|
||||||
"prettier": "2.8.1",
|
"prettier": "2.8.1",
|
||||||
"semantic-release": "25.0.3",
|
|
||||||
"typescript": "4.9.4",
|
"typescript": "4.9.4",
|
||||||
"vite": "5.4.19",
|
"vite": "5.4.19",
|
||||||
"vite-plugin-pwa": "0.20.5",
|
"vite-plugin-pwa": "0.20.5",
|
||||||
|
|
|
||||||
|
|
@ -1,48 +0,0 @@
|
||||||
import fs from "fs";
|
|
||||||
import path from "path";
|
|
||||||
import { execSync } from "child_process";
|
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = path.dirname(__filename);
|
|
||||||
|
|
||||||
const version = process.argv[2];
|
|
||||||
|
|
||||||
if (!version) {
|
|
||||||
console.error("Version argument missing");
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const root = path.resolve(__dirname, "..");
|
|
||||||
const newVersionTag = `v${version}`;
|
|
||||||
|
|
||||||
// Update package.json + package-lock.json safely
|
|
||||||
execSync(`npm version ${version} --no-git-tag-version`, {
|
|
||||||
cwd: root,
|
|
||||||
stdio: "inherit",
|
|
||||||
});
|
|
||||||
|
|
||||||
console.log(`Updated package.json and package-lock.json → ${version}`);
|
|
||||||
|
|
||||||
// Update UI version references
|
|
||||||
const files = [
|
|
||||||
"src/app/features/settings/about/About.tsx",
|
|
||||||
"src/app/pages/auth/AuthFooter.tsx",
|
|
||||||
"src/app/pages/client/WelcomePage.tsx",
|
|
||||||
];
|
|
||||||
|
|
||||||
files.forEach((filePath) => {
|
|
||||||
const absPath = path.join(root, filePath);
|
|
||||||
|
|
||||||
if (!fs.existsSync(absPath)) {
|
|
||||||
console.warn(`File not found: ${filePath}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const content = fs.readFileSync(absPath, "utf8");
|
|
||||||
const updated = content.replace(/v\d+\.\d+\.\d+/g, newVersionTag);
|
|
||||||
|
|
||||||
fs.writeFileSync(absPath, updated);
|
|
||||||
|
|
||||||
console.log(`Updated ${filePath} → ${newVersionTag}`);
|
|
||||||
});
|
|
||||||
|
|
@ -48,7 +48,7 @@ export function About({ requestClose }: AboutProps) {
|
||||||
<Box direction="Column" gap="100">
|
<Box direction="Column" gap="100">
|
||||||
<Box gap="100" alignItems="End">
|
<Box gap="100" alignItems="End">
|
||||||
<Text size="H3">Vojo</Text>
|
<Text size="H3">Vojo</Text>
|
||||||
<Text size="T200">v4.11.1</Text>
|
<Text size="T200">{__APP_VERSION__}</Text>
|
||||||
</Box>
|
</Box>
|
||||||
<Text>{t('Settings.about_tagline')}</Text>
|
<Text>{t('Settings.about_tagline')}</Text>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ export function WelcomePage() {
|
||||||
<PageHero
|
<PageHero
|
||||||
icon={<img width="70" height="70" src={VojoSVG} alt="Vojo Logo" />}
|
icon={<img width="70" height="70" src={VojoSVG} alt="Vojo Logo" />}
|
||||||
title="Welcome to Vojo"
|
title="Welcome to Vojo"
|
||||||
subTitle={<span>v4.11.1</span>}
|
subTitle={<span>{__APP_VERSION__}</span>}
|
||||||
/>
|
/>
|
||||||
</PageHeroSection>
|
</PageHeroSection>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
|
||||||
2
src/ext.d.ts
vendored
2
src/ext.d.ts
vendored
|
|
@ -1,5 +1,7 @@
|
||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
|
declare const __APP_VERSION__: string;
|
||||||
|
|
||||||
declare module 'browser-encrypt-attachment' {
|
declare module 'browser-encrypt-attachment' {
|
||||||
export interface EncryptedAttachmentInfo {
|
export interface EncryptedAttachmentInfo {
|
||||||
v: string;
|
v: string;
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,24 @@ import topLevelAwait from 'vite-plugin-top-level-await';
|
||||||
import { VitePWA } from 'vite-plugin-pwa';
|
import { VitePWA } from 'vite-plugin-pwa';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
import { execSync } from 'child_process';
|
||||||
import buildConfig from './build.config';
|
import buildConfig from './build.config';
|
||||||
|
|
||||||
|
function resolveAppVersion() {
|
||||||
|
if (process.env.VITE_APP_VERSION) return process.env.VITE_APP_VERSION;
|
||||||
|
try {
|
||||||
|
return execSync('git describe --tags --always --dirty', {
|
||||||
|
stdio: ['ignore', 'pipe', 'ignore'],
|
||||||
|
})
|
||||||
|
.toString()
|
||||||
|
.trim();
|
||||||
|
} catch {
|
||||||
|
// Fallback for builds without a usable .git (e.g. Docker — .git is in .dockerignore)
|
||||||
|
const pkg = JSON.parse(fs.readFileSync(path.resolve('package.json'), 'utf8'));
|
||||||
|
return `v${pkg.version}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const copyFiles = {
|
const copyFiles = {
|
||||||
targets: [
|
targets: [
|
||||||
{
|
{
|
||||||
|
|
@ -82,6 +98,9 @@ export default defineConfig({
|
||||||
appType: 'spa',
|
appType: 'spa',
|
||||||
publicDir: false,
|
publicDir: false,
|
||||||
base: buildConfig.base,
|
base: buildConfig.base,
|
||||||
|
define: {
|
||||||
|
__APP_VERSION__: JSON.stringify(resolveAppVersion()),
|
||||||
|
},
|
||||||
server: {
|
server: {
|
||||||
port: 8080,
|
port: 8080,
|
||||||
host: true,
|
host: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue