Skip to content

Commit

Permalink
Update builder
Browse files Browse the repository at this point in the history
  • Loading branch information
zachhuff386 committed Oct 30, 2024
1 parent f0b7743 commit a6d952f
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions tools/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
CHANGES_PATH = 'CHANGES'
CONSTANTS_PATH = 'service/constants/constants.go'
CONSTANTS_PATH2 = 'client/package.json'
CONSTANTS_PATH3 = 'cli/constants/constants.go'
CONSTANTS_PATH4 = 'resources_win/setup.iss'
CONSTANTS_PATH3 = 'client/package-lock.json'
CONSTANTS_PATH4 = 'cli/constants/constants.go'
CONSTANTS_PATH5 = 'resources_win/setup.iss'
STABLE_PACUR_PATH = '../pritunl-pacur'
TEST_PACUR_PATH = '../pritunl-pacur-test'
BUILD_KEYS_PATH = 'tools/build_keys.json'
Expand Down Expand Up @@ -196,7 +197,7 @@ def iter_packages():
for name in os.listdir(target_path):
if cur_version not in name:
continue
elif name.endswith(".pkg.tar.xz"):
elif name.endswith(".pkg.tar.zst"):
pass
elif name.endswith(".rpm"):
pass
Expand Down Expand Up @@ -272,17 +273,28 @@ def generate_last_modifited_etag(file_path):
constants_data = constants_file.read()

with open(CONSTANTS_PATH3, 'w') as constants_file:
constants_file.write(re.sub(
'("version": ".*?")',
'"version": "%s"' % new_version,
constants_data,
count=2,
))

with open(CONSTANTS_PATH4, 'r') as constants_file:
constants_data = constants_file.read()

with open(CONSTANTS_PATH4, 'w') as constants_file:
constants_file.write(re.sub(
'(Version = ".*?")',
'Version = "%s"' % new_version,
constants_data,
count=1,
))

with open(CONSTANTS_PATH4, 'r') as constants_file:
with open(CONSTANTS_PATH5, 'r') as constants_file:
constants_data = constants_file.read()

with open(CONSTANTS_PATH4, 'w') as constants_file:
with open(CONSTANTS_PATH5, 'w') as constants_file:
constants_file.write(re.sub(
'(MyAppVersion ".*?")',
'MyAppVersion "%s"' % new_version,
Expand Down Expand Up @@ -344,6 +356,7 @@ def generate_last_modifited_etag(file_path):
subprocess.check_call(['git', 'add', CONSTANTS_PATH2])
subprocess.check_call(['git', 'add', CONSTANTS_PATH3])
subprocess.check_call(['git', 'add', CONSTANTS_PATH4])
subprocess.check_call(['git', 'add', CONSTANTS_PATH5])
subprocess.check_call(['git', 'commit', '-S', '-m', 'Create new release'])
subprocess.check_call(['git', 'push'])

Expand Down Expand Up @@ -486,23 +499,8 @@ def generate_last_modifited_etag(file_path):
)

subprocess.check_call([
'mc',
'mirror',
'--remove',
'--overwrite',
'--md5',
'mirror',
'repo-east/unstable',
], cwd=pacur_path)

subprocess.check_call([
'mc',
'mirror',
'--remove',
'--overwrite',
'--md5',
'mirror',
'repo-west/unstable',
'sh',
'upload-unstable.sh',
], cwd=pacur_path)

for name, path in iter_packages():
Expand Down

0 comments on commit a6d952f

Please sign in to comment.