mirror of
https://github.com/SoPat712/videospeed.git
synced 2025-08-21 09:58:45 -04:00
versioning stuff
This commit is contained in:
31
build.py
31
build.py
@@ -1,3 +1,4 @@
|
|||||||
|
import glob
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import shutil
|
import shutil
|
||||||
@@ -53,6 +54,15 @@ def update_version_line(file_path, new_version):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
# Step 0: Remove all existing .xpi files upfront
|
||||||
|
xpi_files = glob.glob("*.xpi")
|
||||||
|
for f in xpi_files:
|
||||||
|
try:
|
||||||
|
os.remove(f)
|
||||||
|
print(f"🗑️ Removed existing archive: {f}")
|
||||||
|
except Exception as e:
|
||||||
|
print(f"⚠️ Failed to remove {f}: {e}")
|
||||||
|
|
||||||
base_version = input("Enter the new base version (e.g., 2.0.1): ").strip()
|
base_version = input("Enter the new base version (e.g., 2.0.1): ").strip()
|
||||||
if not base_version:
|
if not base_version:
|
||||||
print("❌ No version entered. Exiting.")
|
print("❌ No version entered. Exiting.")
|
||||||
@@ -62,27 +72,28 @@ def main():
|
|||||||
current_dir = os.getcwd()
|
current_dir = os.getcwd()
|
||||||
manifest_path = os.path.join(current_dir, TARGET_FILE)
|
manifest_path = os.path.join(current_dir, TARGET_FILE)
|
||||||
|
|
||||||
# Determine what to exclude
|
# Step 1: Update manifest.json on disk to base_version
|
||||||
exclude_files = [SCRIPT_NAME] + [
|
|
||||||
f for f in os.listdir(current_dir) if f.endswith(".xpi")
|
|
||||||
]
|
|
||||||
exclude_dirs = [".git"]
|
|
||||||
|
|
||||||
# Step 1: Update manifest.json on disk
|
|
||||||
if os.path.exists(manifest_path):
|
if os.path.exists(manifest_path):
|
||||||
update_version_line(manifest_path, base_version)
|
update_version_line(manifest_path, base_version)
|
||||||
else:
|
else:
|
||||||
print(f"❌ {TARGET_FILE} not found. Aborting.")
|
print(f"❌ {TARGET_FILE} not found. Aborting.")
|
||||||
return
|
return
|
||||||
|
|
||||||
# Step 2: Create GitHub .xpi archive
|
# Step 2: Create videospeed-github.xpi (exclude script, .git, AND videospeed-github.xpi itself)
|
||||||
|
exclude_files = [SCRIPT_NAME, "videospeed-github.xpi"]
|
||||||
|
exclude_dirs = [".git"]
|
||||||
zip_folder("videospeed-github.xpi", current_dir, exclude_files, exclude_dirs)
|
zip_folder("videospeed-github.xpi", current_dir, exclude_files, exclude_dirs)
|
||||||
print("✅ Created videospeed-github.xpi")
|
print("✅ Created videospeed-github.xpi")
|
||||||
|
|
||||||
# Step 3: Prepare Firefox archive with version bumped to .0
|
# Step 3: Re-scan for .xpi files after GitHub archive creation, exclude them for Firefox zip
|
||||||
|
current_xpi_files = set(glob.glob("*.xpi"))
|
||||||
|
exclude_temp_files = current_xpi_files.union({SCRIPT_NAME})
|
||||||
|
exclude_temp_dirs = set(exclude_dirs)
|
||||||
|
|
||||||
|
# Step 4: Create videospeed-firefox.xpi from temp folder with version bumped to .0
|
||||||
with tempfile.TemporaryDirectory() as temp_dir:
|
with tempfile.TemporaryDirectory() as temp_dir:
|
||||||
for item in os.listdir(current_dir):
|
for item in os.listdir(current_dir):
|
||||||
if item in exclude_files or item in exclude_dirs:
|
if item in exclude_temp_files or item in exclude_temp_dirs:
|
||||||
continue
|
continue
|
||||||
src = os.path.join(current_dir, item)
|
src = os.path.join(current_dir, item)
|
||||||
dst = os.path.join(temp_dir, item)
|
dst = os.path.join(temp_dir, item)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "Video Speed Controller",
|
"name": "Video Speed Controller",
|
||||||
"short_name": "videospeed",
|
"short_name": "videospeed",
|
||||||
"version": "1.3.0",
|
"version": "1.4.1",
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"description": "Speed up, slow down, advance and rewind HTML5 audio/video with shortcuts",
|
"description": "Speed up, slow down, advance and rewind HTML5 audio/video with shortcuts",
|
||||||
"homepage_url": "https://github.com/SoPat712/videospeed",
|
"homepage_url": "https://github.com/SoPat712/videospeed",
|
||||||
|
Reference in New Issue
Block a user