mirror of
https://github.com/zen-browser/desktop.git
synced 2025-07-08 00:10:00 +02:00
Add support for updating the l10n last commit hash and new script option
This commit is contained in:
parent
c19748bbbe
commit
8d2e0b0a89
6 changed files with 31 additions and 6 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -9,3 +9,5 @@ dist/
|
|||
|
||||
windsign-temp/
|
||||
venv/
|
||||
|
||||
!firefox-cache/
|
||||
|
|
1
firefox-cache/l10n-last-commit-hash
Normal file
1
firefox-cache/l10n-last-commit-hash
Normal file
|
@ -0,0 +1 @@
|
|||
ffe2107fb72c9893f7500ddd8f490adb436d71c7
|
0
l10n-last-commit-hash
Normal file
0
l10n-last-commit-hash
Normal file
|
@ -19,6 +19,7 @@
|
|||
"update-ff:raw": "surfer update",
|
||||
"update-newtab": "python3 scripts/update_newtab.py",
|
||||
"update-ff:rc": "python3 scripts/update_ff.py --rc",
|
||||
"update-ff:l10n": "python3 scripts/update_ff.py --just-l10n",
|
||||
"pretty": "prettier . --write && autopep8 -r --in-place scripts/ src/",
|
||||
"lint": "npx prettier . --check && autopep8 --diff scripts/ src/",
|
||||
"prepare": "husky",
|
||||
|
|
|
@ -7,8 +7,13 @@ git config --global fetch.prune true
|
|||
|
||||
cd $CURRENT_DIR
|
||||
|
||||
LAST_FIREFOX_L10N_COMMIT=$(cat ./firefox-cache/l10n-last-commit-hash)
|
||||
|
||||
cd ./l10n
|
||||
# clone only from LAST_FIREFOX_L10N_COMMIT
|
||||
git clone https://github.com/mozilla-l10n/firefox-l10n
|
||||
cd firefox-l10n
|
||||
git checkout $LAST_FIREFOX_L10N_COMMIT
|
||||
cd $CURRENT_DIR
|
||||
|
||||
update_language() {
|
||||
|
|
|
@ -56,6 +56,17 @@ def update_readme(last_version, new_version, is_rc=False):
|
|||
except FileNotFoundError as e:
|
||||
raise RuntimeError(f"README.md file not found: {e}")
|
||||
|
||||
def update_l10n_last_commit_hash():
|
||||
L10N_REPO = "https://github.com/mozilla-l10n/firefox-l10n"
|
||||
try:
|
||||
os.system(f"git clone {L10N_REPO} l10n-temp")
|
||||
if not os.path.exists("firefox-cache"):
|
||||
os.mkdir("firefox-cache")
|
||||
with open("l10n-last-commit-hash", "w") as f:
|
||||
os.system("cat l10n-temp/.git/refs/heads/main > firefox-cache/l10n-last-commit-hash")
|
||||
except KeyboardInterrupt:
|
||||
print("Exiting...")
|
||||
shutil.rmtree("l10n-temp")
|
||||
|
||||
def main():
|
||||
"""Main function to update versions and README."""
|
||||
|
@ -63,15 +74,20 @@ def main():
|
|||
arg_parser = argparse.ArgumentParser()
|
||||
arg_parser.add_argument(
|
||||
"--rc", help="Indicates that this is a release candidate.", default=False, action="store_true")
|
||||
arg_parser.add_argument(
|
||||
"--just-l10n", help="Only update the l10n last commit hash.", default=False, action="store_true")
|
||||
args = arg_parser.parse_args()
|
||||
|
||||
try:
|
||||
last_version = get_version_from_file("surfer.json", args.rc)
|
||||
update_ff(args.rc, last_version)
|
||||
new_version = get_version_from_file("surfer.json", args.rc)
|
||||
update_readme(last_version, new_version, args.rc)
|
||||
print(
|
||||
f"Updated version from {last_version} to {new_version} in README.md.")
|
||||
if not args.just_l10n:
|
||||
last_version = get_version_from_file("surfer.json", args.rc)
|
||||
update_ff(args.rc, last_version)
|
||||
new_version = get_version_from_file("surfer.json", args.rc)
|
||||
update_readme(last_version, new_version, args.rc)
|
||||
print(
|
||||
f"Updated version from {last_version} to {new_version} in README.md.")
|
||||
print("Updating l10n last commit hash.")
|
||||
update_l10n_last_commit_hash()
|
||||
except Exception as e:
|
||||
print(f"An error occurred: {e}")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue