diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index c9a232f..c229ca0 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -64,6 +64,8 @@ jobs: - name: Build and create DMG for macOS if: matrix.platform == 'macos-latest' run: | + APP_VERSION=$(node -p "require('./package.json').version") + pnpm build cd src-tauri cargo build --release --target ${{ matrix.args }} @@ -76,7 +78,7 @@ jobs: cp "src-tauri/target/$TARGET_ARCH/release/revelations-launcher" "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Revelations Launcher.app/Contents/MacOS/" - printf '\n\n\n\n CFBundleExecutable\n revelations-launcher\n CFBundleIdentifier\n com.revelations.lce\n CFBundleName\n Revelations Launcher\n CFBundleVersion\n 1.1.2\n CFBundleShortVersionString\n 1.1.2\n CFBundlePackageType\n APPL\n NSHighResolutionCapable\n \n LSApplicationCategoryType\n public.app-category.games\n\n\n' > "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Revelations Launcher.app/Contents/Info.plist" + printf '\n\n\n\n CFBundleExecutable\n revelations-launcher\n CFBundleIdentifier\n com.revelations.lce\n CFBundleName\n Revelations Launcher\n CFBundleVersion\n '"$APP_VERSION"'\n CFBundleShortVersionString\n '"$APP_VERSION"'\n CFBundlePackageType\n APPL\n NSHighResolutionCapable\n \n LSApplicationCategoryType\n public.app-category.games\n\n\n' > "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Revelations Launcher.app/Contents/Info.plist" if [ -f "src-tauri/icons/icon.icns" ]; then cp src-tauri/icons/icon.icns "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Revelations Launcher.app/Contents/Resources/" diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e35a944..fe46484 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -55,23 +55,25 @@ jobs: - name: Create PKG with post-install script if: matrix.platform == 'macos-latest' run: | + APP_VERSION=$(node -p "require('./package.json').version") + # Create temporary directory for PKG creation mkdir -p pkg_temp/scripts cp scripts/postinstall.sh pkg_temp/scripts/ - + # Build the app first pnpm tauri build -- ${{ matrix.args }} - + # Find the built app APP_PATH=$(find src-tauri/target/release/bundle/macos/ -name "*.app" | head -1) APP_NAME=$(basename "$APP_PATH") - + # Create PKG with post-install script pkgbuild --root "$APP_PATH/.." \ --install-location /Applications \ --scripts pkg_temp/scripts \ --identifier "com.revelations.lce" \ - --version "1.0.0" \ + --version "$APP_VERSION" \ --install-location "/Applications" \ --root "$APP_PATH" \ "Revelations-Launcher.pkg" @@ -82,19 +84,21 @@ jobs: - name: Build and create DMG for macOS if: matrix.platform == 'macos-latest' run: | + APP_VERSION=$(node -p "require('./package.json').version") + pnpm build cd src-tauri cargo build --release --target ${{ matrix.args }} cd .. - + TARGET_ARCH=${{ matrix.args == '--target aarch64-apple-darwin' && 'aarch64-apple-darwin' || 'x86_64-apple-darwin' }} - + mkdir -p "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Revelations Launcher.app/Contents/MacOS" mkdir -p "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Revelations Launcher.app/Contents/Resources" - + cp "src-tauri/target/$TARGET_ARCH/release/revelations-launcher" "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Revelations Launcher.app/Contents/MacOS/" - - printf '\n\n\n\n CFBundleExecutable\n revelations-launcher\n CFBundleIdentifier\n com.revelations.lce\n CFBundleName\n Revelations Launcher\n CFBundleVersion\n 1.0.0\n CFBundleShortVersionString\n 1.0.0\n CFBundlePackageType\n APPL\n NSHighResolutionCapable\n \n LSApplicationCategoryType\n public.app-category.games\n\n\n' > "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Revelations Launcher.app/Contents/Info.plist" + + printf '\n\n\n\n CFBundleExecutable\n revelations-launcher\n CFBundleIdentifier\n com.revelations.lce\n CFBundleName\n Revelations Launcher\n CFBundleVersion\n '"$APP_VERSION"'\n CFBundleShortVersionString\n '"$APP_VERSION"'\n CFBundlePackageType\n APPL\n NSHighResolutionCapable\n \n LSApplicationCategoryType\n public.app-category.games\n\n\n' > "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Revelations Launcher.app/Contents/Info.plist" if [ -f "src-tauri/icons/icon.icns" ]; then cp src-tauri/icons/icon.icns "src-tauri/target/$TARGET_ARCH/release/bundle/macos/Revelations Launcher.app/Contents/Resources/" diff --git a/README.md b/README.md index 9df7251..1828618 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ More versions coming in future updates. --- -### LATEST: v1.1.2 +### LATEST: v1.1.4 - Automatic game update detection with one-click updates (for custom instances, too!) - Custom skin support with PCK packing (Steve & Alex models) (Other players can see your skin) diff --git a/package.json b/package.json index ffbf19b..891d4fb 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "revelations-launcher", "private": true, - "version": "1.1.2", + "version": "1.1.4", "type": "module", "scripts": { "dev": "vite", @@ -9,7 +9,8 @@ "preview": "vite preview", "tauri": "tauri", "tauri:build": "tauri build && pnpm run post-build:macos", - "post-build:macos": "sh src-tauri/scripts/post-build-macos.sh" + "post-build:macos": "sh src-tauri/scripts/post-build-macos.sh", + "bump": "node scripts/bump-version.mjs" }, "dependencies": { "@tauri-apps/api": "^2", diff --git a/scripts/bump-version.mjs b/scripts/bump-version.mjs new file mode 100644 index 0000000..b3c5387 --- /dev/null +++ b/scripts/bump-version.mjs @@ -0,0 +1,44 @@ +import { readFileSync, writeFileSync } from "fs"; +import { resolve, dirname } from "path"; +import { fileURLToPath } from "url"; + +const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const version = process.argv[2]; + +if (!version || !/^\d+\.\d+\.\d+$/.test(version)) { + console.error("Usage: pnpm bump (e.g. pnpm bump 1.2.0)"); + process.exit(1); +} + +const files = [ + { + path: "package.json", + replace: (s) => s.replace(/"version":\s*"[^"]+"/, `"version": "${version}"`), + }, + { + path: "src-tauri/tauri.conf.json", + replace: (s) => s.replace(/"version":\s*"[^"]+"/, `"version": "${version}"`), + }, + { + path: "src-tauri/Cargo.toml", + replace: (s) => s.replace(/^version = "[^"]+"/m, `version = "${version}"`), + }, + { + path: "README.md", + replace: (s) => s.replace(/### LATEST: v[\d.]+/, `### LATEST: v${version}`), + }, +]; + +for (const file of files) { + const fullPath = resolve(root, file.path); + const original = readFileSync(fullPath, "utf-8"); + const updated = file.replace(original); + if (original === updated) { + console.warn(` skip ${file.path} (no match or already at ${version})`); + } else { + writeFileSync(fullPath, updated); + console.log(` done ${file.path} -> ${version}`); + } +} + +console.log(`\nBumped to ${version}`); diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index cc35cb8..d7fbd57 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "revelations-launcher" -version = "1.1.2" +version = "1.1.4" description = "A FOSS, cross-platform launcher for Minecraft Legacy Console Edition" authors = ["itsRevela"] edition = "2021" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index b472b29..56710fa 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "Revelations Launcher", - "version": "1.1.2", + "version": "1.1.4", "identifier": "com.revelations.lce", "build": { "beforeDevCommand": "npm run dev", diff --git a/src/pages/App.tsx b/src/pages/App.tsx index 7985486..5043d3b 100644 --- a/src/pages/App.tsx +++ b/src/pages/App.tsx @@ -346,7 +346,7 @@ export default function App() { className="shrink-0 p-4 flex justify-between items-end text-[10px] text-[#A0A0A0] mc-text-shadow bg-gradient-to-t from-black/80 to-transparent uppercase tracking-widest opacity-60 font-['Mojangles']" style={{ fontWeight: "normal" }} > -
Version: 1.1.2
+
Version: {__APP_VERSION__}
Not affiliated with Mojang AB or Microsoft. "Minecraft" is a trademark of Mojang Synergies AB.
diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 7d0ff9e..f25d6b0 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -1 +1,3 @@ /// + +declare const __APP_VERSION__: string; diff --git a/vite.config.ts b/vite.config.ts index 5bfc4ed..a3db635 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,8 +1,12 @@ import { defineConfig } from 'vite' import tailwindcss from '@tailwindcss/vite' import react from '@vitejs/plugin-react' +import pkg from './package.json' with { type: 'json' } export default defineConfig({ + define: { + __APP_VERSION__: JSON.stringify(pkg.version), + }, plugins: [ react(), tailwindcss(),