Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openshot
Openshot Qt
提交
b0460350
O
Openshot Qt
项目概览
openshot
/
Openshot Qt
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
Openshot Qt
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
b0460350
编写于
10月 04, 2016
作者:
J
Jonathan Thomas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Updating build server to use GitHub as an upload target, rather than Amazon S3
上级
42e4f3aa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
10 deletion
+29
-10
installer/build-server.py
installer/build-server.py
+29
-10
未找到文件。
installer/build-server.py
浏览文件 @
b0460350
...
...
@@ -41,6 +41,7 @@ import sys
import
tinys3
import
traceback
from
PyQt5.QtCore
import
QLibraryInfo
from
github3
import
login
freeze_command
=
None
...
...
@@ -54,6 +55,9 @@ s3_secret_key = None
s3_connection
=
None
windows_key
=
None
windows_key_password
=
None
github_user
=
None
github_pass
=
None
github_release
=
None
commit_data
=
{}
# Create temp log
...
...
@@ -136,21 +140,31 @@ def slack_upload_log(log, title, comment=None):
# Re-open the log (for append)
log
=
open
(
log_path
,
"a"
)
def
upload
(
file_path
,
s3_bucket
):
"""Upload a file to S3 (retry 3 times)"""
def
get_release
(
repo
,
tag_name
):
"""Fetch the GitHub release tagged with the given tag and return it
@param repo: github3 repository object
@returns: github3 release object or None
"""
for
release
in
repo
.
iter_releases
():
if
release
.
tag_name
==
tag_name
:
return
release
def
upload
(
file_path
,
github_release
):
"""Upload a file to GitHub (retry 3 times)"""
if
s3_connection
:
folder_path
,
file_name
=
os
.
path
.
split
(
file_path
)
for
attempt
in
range
(
3
):
try
:
# Attempt the upload
with
open
(
file_path
,
"rb"
)
as
f
:
s3_connection
.
upload
(
file_name
,
f
,
s3_bucket
)
# Upload to GitHub
github_release
.
upload_asset
(
"application/octet-stream"
,
file_name
,
f
)
# Successfully uploaded!
break
except
Exception
as
ex
:
# Quietly fail, and try again
if
attempt
<
2
:
output
(
"
Amazon S3 u
pload failed... trying again"
)
output
(
"
U
pload failed... trying again"
)
else
:
# Throw loud exception
raise
ex
...
...
@@ -158,9 +172,6 @@ def upload(file_path, s3_bucket):
try
:
# Validate command-line arguments
# argv[1] = Slack_token
# argv[2] = S3 access key
# argv[3] = S3 secret key
if
len
(
sys
.
argv
)
>=
2
:
slack_token
=
sys
.
argv
[
1
]
slack_object
=
Slacker
(
slack_token
)
...
...
@@ -171,6 +182,14 @@ try:
if
len
(
sys
.
argv
)
>=
6
:
windows_key
=
sys
.
argv
[
4
]
windows_key_password
=
sys
.
argv
[
5
]
if
len
(
sys
.
argv
)
>=
8
:
github_user
=
sys
.
argv
[
6
]
github_pass
=
sys
.
argv
[
7
]
# Login and get "GitHub" object
gh
=
login
(
github_user
,
github_pass
)
repo
=
gh
.
repository
(
"OpenShot"
,
"openshot-qt"
)
github_release
=
get_release
(
repo
,
"daily"
)
# Start log
output
(
"%s Build Log for %s"
%
(
platform
.
system
(),
datetime
.
datetime
.
now
().
strftime
(
"%Y-%m-%d %H:%M:%S"
)))
...
...
@@ -485,9 +504,9 @@ try:
if
needs_upload
:
# Check if app exists
if
os
.
path
.
exists
(
app_build_path
):
# Upload file to
S3
output
(
"
S3: Uploading %s to Amazon S3"
%
app_build_path
)
upload
(
app_build_path
,
app_upload_bucket
)
# Upload file to
GitHub
output
(
"
GitHub: Uploading %s to GitHub Release: %s"
%
(
app_build_path
,
github_release
.
tag_name
)
)
upload
(
app_build_path
,
github_release
)
# Notify Slack
slack_upload_log
(
log
,
"%s: Build logs for %s"
%
(
platform
.
system
(),
app_name
),
"Successful build: http://%s/%s"
%
(
app_upload_bucket
,
app_name
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录