added uploading to mk.py
This commit is contained in:
parent
942c237a08
commit
4f8e6031b0
2 changed files with 43 additions and 10 deletions
4
Makefile
4
Makefile
|
|
@ -11,6 +11,10 @@ help :
|
||||||
@echo " build - Perform './mach build && ./mach package' on it."
|
@echo " build - Perform './mach build && ./mach package' on it."
|
||||||
@echo " artifacts - Create the setup.exe and the portable.zip."
|
@echo " artifacts - Create the setup.exe and the portable.zip."
|
||||||
@echo ""
|
@echo ""
|
||||||
|
@echo "Note: to upload, after artifacts, into the windows repo, use:"
|
||||||
|
@echo ""
|
||||||
|
@echo " python3 mk.py upload <token>"
|
||||||
|
@echo ""
|
||||||
|
|
||||||
all : fetch build artifacts
|
all : fetch build artifacts
|
||||||
|
|
||||||
|
|
|
||||||
49
mk.py
49
mk.py
|
|
@ -86,9 +86,7 @@ def build():
|
||||||
|
|
||||||
|
|
||||||
def artifacts():
|
def artifacts():
|
||||||
print('[debug] # guide - you gotta figure this out from the previous ./build.py')
|
|
||||||
pass
|
|
||||||
|
|
||||||
with open('version','r') as file1:
|
with open('version','r') as file1:
|
||||||
version = file1.read().rstrip()
|
version = file1.read().rstrip()
|
||||||
buildzip_filename = 'firefox-{}.en-US.win64.zip'.format(version)
|
buildzip_filename = 'firefox-{}.en-US.win64.zip'.format(version)
|
||||||
|
|
@ -106,7 +104,6 @@ def artifacts():
|
||||||
with open('release','r') as file2:
|
with open('release','r') as file2:
|
||||||
release = file2.read().rstrip()
|
release = file2.read().rstrip()
|
||||||
full_version = '{}.{}'.format(version,release)
|
full_version = '{}.{}'.format(version,release)
|
||||||
print('[debug] mk.py: artifacts(): Building for ful version: {}'.format(full_version))
|
|
||||||
|
|
||||||
# let's copy in the .ico icon.
|
# let's copy in the .ico icon.
|
||||||
exec('cp -v assets/librewolf.ico work/librewolf')
|
exec('cp -v assets/librewolf.ico work/librewolf')
|
||||||
|
|
@ -118,20 +115,45 @@ def artifacts():
|
||||||
os.makedirs('librewolf-{}/LibreWolf'.format(version), exist_ok=True)
|
os.makedirs('librewolf-{}/LibreWolf'.format(version), exist_ok=True)
|
||||||
exec('cp -vr librewolf/* librewolf-{}/LibreWolf'.format(version))
|
exec('cp -vr librewolf/* librewolf-{}/LibreWolf'.format(version))
|
||||||
exec('wget -q -O librewolf-{}/librewolf-portable.exe https://gitlab.com/librewolf-community/browser/windows/uploads/8347381f01806245121adcca11b7f35c/librewolf-portable.exe'.format(version))
|
exec('wget -q -O librewolf-{}/librewolf-portable.exe https://gitlab.com/librewolf-community/browser/windows/uploads/8347381f01806245121adcca11b7f35c/librewolf-portable.exe'.format(version))
|
||||||
zipname = '../librewolf-{}.en-US.win64.zip'.format(full_version)
|
zipname = 'librewolf-{}.en-US.win64.zip'.format(full_version)
|
||||||
exec("rm -f {}".format(zipname))
|
exec("rm -f ../{}".format(zipname))
|
||||||
exec("zip -qr9 {} librewolf-{}".format(zipname,version))
|
exec("zip -qr9 ../{} librewolf-{}".format(zipname,version))
|
||||||
os.chdir('..')
|
os.chdir('..')
|
||||||
|
|
||||||
# With that out of the way, we need to create the nsis setup.
|
# With that out of the way, we need to create the nsis setup.
|
||||||
os.chdir('work')
|
os.chdir('work')
|
||||||
setupname = "librewolf-{}.en-US.win64-setup.exe".format(full_version)
|
setupname = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version)
|
||||||
exec("sed \"s/pkg_version/{}/g\" < ../assets/setup.nsi > tmp.nsi".format(full_version))
|
exec('sed \"s/pkg_version/{}/g\" < ../assets/setup.nsi > tmp.nsi'.format(full_version))
|
||||||
exec('makensis-3.01.exe -V1 tmp.nsi')
|
exec('makensis-3.01.exe -V1 tmp.nsi')
|
||||||
exec('rm -f tmp.nsi')
|
exec('rm -f tmp.nsi')
|
||||||
exec("mv {} ..".format(setupname))
|
exec("mv {} ..".format(setupname))
|
||||||
os.chdir('..')
|
os.chdir('..')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def do_upload(filename,token):
|
||||||
|
exec('echo _ >> upload.txt')
|
||||||
|
exec('curl --request POST --header \"PRIVATE-TOKEN: {}\" --form \"file=@{}\" \"https://gitlab.com/api/v4/projects/13852981/uploads\" >> upload.txt'.format(token,filename))
|
||||||
|
exec('echo _ >> upload.txt')
|
||||||
|
|
||||||
|
def upload(token):
|
||||||
|
|
||||||
|
with open('version','r') as file1:
|
||||||
|
version = file1.read().rstrip()
|
||||||
|
with open('release','r') as file2:
|
||||||
|
release = file2.read().rstrip()
|
||||||
|
full_version = '{}.{}'.format(version,release)
|
||||||
|
|
||||||
|
# Files we need to upload..
|
||||||
|
zip_filename = 'librewolf-{}.en-US.win64.zip'.format(full_version)
|
||||||
|
setup_filename = 'librewolf-{}.en-US.win64-setup.exe'.format(full_version)
|
||||||
|
exec('md5sum {} {} > md5sums.txt'.format(setup_filename,zip_filename))
|
||||||
|
exec('rm -f upload.txt')
|
||||||
|
do_upload(setup_filename,token)
|
||||||
|
do_upload(zip_filename,token)
|
||||||
|
do_upload('md5sums.txt',token)
|
||||||
|
|
||||||
#
|
#
|
||||||
# parse commandline for commands
|
# parse commandline for commands
|
||||||
#
|
#
|
||||||
|
|
@ -143,13 +165,18 @@ commands:
|
||||||
fetch
|
fetch
|
||||||
build
|
build
|
||||||
artifacts
|
artifacts
|
||||||
|
upload <token>
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
done_something = False
|
done_something = False
|
||||||
|
|
||||||
|
in_upload=False
|
||||||
for arg in sys.argv:
|
for arg in sys.argv:
|
||||||
if arg == 'fetch':
|
if in_upload:
|
||||||
|
upload(arg)
|
||||||
|
done_something=True
|
||||||
|
elif arg == 'fetch':
|
||||||
fetch()
|
fetch()
|
||||||
done_something = True
|
done_something = True
|
||||||
elif arg == 'build':
|
elif arg == 'build':
|
||||||
|
|
@ -158,6 +185,8 @@ for arg in sys.argv:
|
||||||
elif arg == 'artifacts':
|
elif arg == 'artifacts':
|
||||||
artifacts()
|
artifacts()
|
||||||
done_something = True
|
done_something = True
|
||||||
|
elif arg == 'upload':
|
||||||
|
in_upload = True
|
||||||
else:
|
else:
|
||||||
if arg == sys.argv[0]:
|
if arg == sys.argv[0]:
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue