AppVeyor: Sanitize the file name before uploading

merge-requests/60/head
Chin 2015-01-24 10:45:06 +07:00
parent 9121a5db1a
commit a4a1ce766d
2 changed files with 9 additions and 7 deletions

@ -6,9 +6,11 @@ clone_depth: 1
environment: environment:
QTDIR: C:\Qt\5.4\msvc2013_opengl QTDIR: C:\Qt\5.4\msvc2013_opengl
MEGA_EMAIL:
secure: dLyH/46MKKuCZyozkwwVGCL7nVyX+Cxyo1hVlCUaQDU=
MEGA_PASSWORD: MEGA_PASSWORD:
secure: ozgp54EZj98kcbD/O+Xl5Q== secure: ozgp54EZj98kcbD/O+Xl5Q==
platform: platform:
- Win32 - Win32
@ -23,7 +25,7 @@ before_build:
- cd build - cd build
- cmake .. - cmake ..
- cd .. - cd ..
after_build: after_build:
# upload the build to Mega # upload the build to Mega
- cinst wget -x86 - cinst wget -x86
@ -38,12 +40,9 @@ after_build:
- copy C:\Qt\5.4\msvc2013_opengl\bin\Qt5Gui.dll build\bin\release - copy C:\Qt\5.4\msvc2013_opengl\bin\Qt5Gui.dll build\bin\release
- copy C:\Qt\5.4\msvc2013_opengl\bin\Qt5OpenGL.dll build\bin\release - copy C:\Qt\5.4\msvc2013_opengl\bin\Qt5OpenGL.dll build\bin\release
- copy C:\Qt\5.4\msvc2013_opengl\bin\Qt5Widgets.dll build\bin\release - copy C:\Qt\5.4\msvc2013_opengl\bin\Qt5Widgets.dll build\bin\release
# delete build craps
- del /F /S /Q /A "build\bin\release\*.ilk"
- del /F /S /Q /A "build\bin\release\*.pdb"
# zip up the build folder -> build.7z # zip up the build folder -> build.7z
- 7z a build .\build\bin\release\* - 7z a build .\build\bin\release\*
# rename, upload to Mega # rename, upload to Mega
- npm install sanitize-filename
- cd megatools-1.9.94-win64 - cd megatools-1.9.94-win64
- node ..\upload_to_mega.js - node ..\upload_to_mega.js

@ -1,11 +1,13 @@
var util = require('util'); var util = require('util');
var exec = require('child_process').exec; var exec = require('child_process').exec;
var sanitize = require("sanitize-filename");
var email = 'chin.bimbo@gmail.com'; var email = process.env.MEGA_EMAIL;
var password = process.env.MEGA_PASSWORD; var password = process.env.MEGA_PASSWORD;
var sourceFileName = 'build.7z'; var sourceFileName = 'build.7z';
var dstFileName = process.env.APPVEYOR_REPO_COMMIT.substring(0, 8) + " - " + var dstFileName = process.env.APPVEYOR_REPO_COMMIT.substring(0, 8) + " - " +
process.env.APPVEYOR_REPO_COMMIT_MESSAGE.substring(0, 100) + ".7z"; process.env.APPVEYOR_REPO_COMMIT_MESSAGE.substring(0, 100) + ".7z";
dstFileName = sanitize(dstFileName);
var cmd = util.format('megaput ../%s --path \"/Root/Citra/Windows/%s\" --username=%s --password=%s --no-progress', var cmd = util.format('megaput ../%s --path \"/Root/Citra/Windows/%s\" --username=%s --password=%s --no-progress',
sourceFileName, sourceFileName,
@ -13,6 +15,7 @@ var cmd = util.format('megaput ../%s --path \"/Root/Citra/Windows/%s\" --usernam
email, email,
password); password);
// only upload build on master branch, and not on other branches or PRs
if (process.env.APPVEYOR_REPO_BRANCH == "master") { if (process.env.APPVEYOR_REPO_BRANCH == "master") {
console.log("Uploading file " + dstFileName + " to Mega..."); console.log("Uploading file " + dstFileName + " to Mega...");
exec(cmd, function(error, stdout, stderr) { exec(cmd, function(error, stdout, stderr) {