Tries to activate automatic artifact deployment to github release from appveyor
This commit is contained in:
11
appveyor.yml
11
appveyor.yml
@@ -23,11 +23,16 @@
|
|||||||
# password:
|
# password:
|
||||||
# secure: $#(JFDA)jQ@#$
|
# secure: $#(JFDA)jQ@#$
|
||||||
|
|
||||||
|
environment:
|
||||||
|
GH_TOKEN:
|
||||||
|
secure: dYnBDQkiY5oVjIlswzBX9BJigNtBGXgGlp1tK3XbHzrDEDrs2vaKD5m+Oz5OSz1C
|
||||||
|
|
||||||
# scripts that run after cloning repository
|
# scripts that run after cloning repository
|
||||||
install:
|
install:
|
||||||
- ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
|
- ps: (new-object net.webclient).DownloadFile('https://raw.github.com/pypa/pip/master/contrib/get-pip.py', 'C:/get-pip.py')
|
||||||
- "C:/Python27/python.exe C:/get-pip.py"
|
- "C:/Python27/python.exe C:/get-pip.py"
|
||||||
- "C:/Python27/Scripts/pip.exe install pyjavaproperties"
|
- "C:/Python27/Scripts/pip.exe install pyjavaproperties"
|
||||||
|
- "C:/Python27/Scripts/pip.exe install github3.py"
|
||||||
|
|
||||||
#---------------------------------#
|
#---------------------------------#
|
||||||
# build configuration #
|
# build configuration #
|
||||||
@@ -62,14 +67,16 @@ artifacts:
|
|||||||
|
|
||||||
# scripts to run before deployment
|
# scripts to run before deployment
|
||||||
before_deploy:
|
before_deploy:
|
||||||
- cd projects/mtg/bin
|
- cd projects/mtg/bin
|
||||||
- "C:/Python27/python.exe createWindowsZip.py"
|
- "C:/Python27/python.exe createWindowsZip.py"
|
||||||
|
- cd ../../..
|
||||||
|
|
||||||
# scripts to run after deployment
|
# scripts to run after deployment
|
||||||
after_deploy:
|
after_deploy:
|
||||||
|
|
||||||
# to run your custom scripts instead of provider deployments
|
# to run your custom scripts instead of provider deployments
|
||||||
deploy_script:
|
deploy_script:
|
||||||
|
- "C:/Python27/python.exe uploadBinary.py -t %GH_TOKEN% -s %APPVEYOR_REPO_COMMIT% -l projects\mtg\bin\Wagic-windows.zip -r Wagic-windows -b %APPVEYOR_REPO_BRANCH%"
|
||||||
|
|
||||||
# to disable deployment
|
# to disable deployment
|
||||||
#deploy: off
|
#deploy: off
|
||||||
|
|||||||
@@ -30,11 +30,9 @@ def createStandardResFile():
|
|||||||
cmd = 'python createResourceZip.py -n ' + getFilename('core') + '.zip'
|
cmd = 'python createResourceZip.py -n ' + getFilename('core') + '.zip'
|
||||||
os.chdir("Res")
|
os.chdir("Res")
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
# os.system("python createResourceZip.py -n resources.zip")
|
|
||||||
os.chdir("..")
|
os.chdir("..")
|
||||||
print "Creating Windows Package File"
|
print "Creating Windows Package File"
|
||||||
filename = getFilename('Wagic-windows') + '.zip'
|
createWindowsZipFile( 'Wagic-windows.zip' )
|
||||||
createWindowsZipFile( filename )
|
|
||||||
print >> sys.stderr, 'Created Resource Package for Standard Distribution: {0}'.format( filename)
|
print >> sys.stderr, 'Created Resource Package for Standard Distribution: {0}'.format( filename)
|
||||||
|
|
||||||
class ZipUtilities:
|
class ZipUtilities:
|
||||||
@@ -68,13 +66,7 @@ def main():
|
|||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if (options.platform):
|
createStandardResFile()
|
||||||
if (options.platform == "ios"):
|
|
||||||
createIosResFile()
|
|
||||||
else:
|
|
||||||
createStandardResFile()
|
|
||||||
else:
|
|
||||||
createStandardResFile()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
50
upload-binaries.py
Normal file
50
upload-binaries.py
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import zipfile
|
||||||
|
from pyjavaproperties import Properties
|
||||||
|
from optparse import OptionParser
|
||||||
|
from github3 import login
|
||||||
|
|
||||||
|
|
||||||
|
def suffixFilename(filename, build):
|
||||||
|
p = Properties();
|
||||||
|
p.load(open('projects/mtg/build.number.properties'));
|
||||||
|
minor = p['build.minor'];
|
||||||
|
major = p['build.major'];
|
||||||
|
point = p['build.point'];
|
||||||
|
name, extension = os.path.splitext(filename)
|
||||||
|
filename = name + '-' + major + minor + point + '-' + build + extension
|
||||||
|
return filename
|
||||||
|
|
||||||
|
def main():
|
||||||
|
parser = OptionParser()
|
||||||
|
parser.add_option("-t", "--token", help="TOKEN: specify authentication token to use", metavar="TOKEN", dest="token")
|
||||||
|
parser.add_option("-s", "--sha", help="SHA: specify commit SHA", metavar="SHA", dest="sha")
|
||||||
|
parser.add_option("-l", "--local", help="FILE: specify local file path to upload", metavar="LOCAL", dest="local")
|
||||||
|
parser.add_option("-r", "--remote", help="NAME: specify remote asset name in the release.", metavar="REMOTE", dest="remote")
|
||||||
|
parser.add_option("-b", "--branch", help="BRANCH: specify branch of the commit", metavar="BRANCH", dest="branch")
|
||||||
|
|
||||||
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
|
if (options.token and options.sha and options.local and options.remote and (options.branch == 'master' or options.branch == 'appveyor')):
|
||||||
|
gh = login(token = options.token)
|
||||||
|
else:
|
||||||
|
parser.print_help()
|
||||||
|
return
|
||||||
|
|
||||||
|
repository = gh.repository('WagicProject', 'wagic')
|
||||||
|
# find reference
|
||||||
|
ref = gh.ref('tags/latest-master')
|
||||||
|
if(ref)
|
||||||
|
ref.update(options.sha)
|
||||||
|
|
||||||
|
for r in repository.iter_releases():
|
||||||
|
if r.name == 'latest-master' :
|
||||||
|
# filename = suffixFilename(options.remote, options.build)
|
||||||
|
filename = options.remote
|
||||||
|
with open(options.local, 'rb') as fd:
|
||||||
|
r.upload_asset('application/zip', filename , fd)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user