File tree Expand file tree Collapse file tree 6 files changed +63
-4
lines changed Expand file tree Collapse file tree 6 files changed +63
-4
lines changed Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ build: &build
32
32
33
33
deploy : &deploy
34
34
docker :
35
- - image : tsub/ghr :latest
35
+ - image : broooooklyn/rust-python :latest
36
36
working_directory : /mnt/crate
37
37
steps :
38
38
- attach_workspace :
@@ -43,7 +43,8 @@ deploy: &deploy
43
43
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
44
44
then
45
45
export GIT_TAG="$(git describe --tags $(git rev-list --tags --max-count=1))"; \
46
- ghr -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" "${GIT_TAG}" build/lib/py_sourcemap/*.so
46
+ ghr -u "${CIRCLE_PROJECT_USERNAME}" -r "${CIRCLE_PROJECT_REPONAME}" "${GIT_TAG}" build/lib/py_sourcemap/*.so && \
47
+ python upload-ali-oss.py
47
48
else
48
49
echo "Not a release, skipping publish"
49
50
fi
Original file line number Diff line number Diff line change @@ -36,3 +36,9 @@ deploy:
36
36
skip_cleanup : true
37
37
on :
38
38
tags : true
39
+
40
+ deploy :
41
+ provider : script
42
+ script : python upload-ali-oss.py
43
+ on :
44
+ tags : true
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ FROM ubuntu:18.04
2
2
3
3
ARG PYTHON_VERSION=3.6
4
4
5
+ ENV GHR_VERSION="0.9.0"
6
+
5
7
ENV RUSTUP_HOME=/usr/local/rustup \
6
8
CARGO_HOME=/usr/local/cargo \
7
9
PATH=/usr/local/cargo/bin:$PATH \
@@ -18,11 +20,19 @@ RUN apt-get update && \
18
20
if [ $PYTHON_VERSION = '3.6' ]; \
19
21
then \
20
22
apt-get install python3-pip -y --no-install-recommends && \
21
- ln -sf /usr/bin/pip3 /usr/bin/pip; \
23
+ ln -sf /usr/bin/pip3 /usr/bin/pip && \
24
+ pip install setuptools; \
22
25
else \
23
26
curl https://bootstrap.pypa.io/get-pip.py | python${PYTHON_VERSION}; \
24
27
fi && \
25
- pip install --upgrade pip
28
+ pip install --upgrade pip && \
29
+ curl -fSL -o ghr.tar.gz "https://github.com/tcnksm/ghr/releases/download/v${GHR_VERSION}/ghr_v${GHR_VERSION}_linux_amd64.tar.gz" && \
30
+ tar -xvzf ghr.tar.gz && \
31
+ mv ghr_v${GHR_VERSION}_linux_amd64/ghr /usr/local/bin && \
32
+ chown root:root /usr/local/bin/ghr && \
33
+ rm -r \
34
+ ghr.tar.gz \
35
+ ghr_v${GHR_VERSION}_linux_amd64
26
36
27
37
RUN set -eux; \
28
38
dpkgArch="$(dpkg --print-architecture)" ; \
Original file line number Diff line number Diff line change @@ -74,6 +74,9 @@ artifacts:
74
74
- path : build\lib\py_sourcemap\*.pyd
75
75
name : Binary
76
76
77
+ before_deploy :
78
+ - " %PYTHON%\\ python.exe upload-ali-oss.py"
79
+
77
80
deploy :
78
81
provider : GitHub
79
82
description : $(APPVEYOR_REPO_TAG_NAME)
Original file line number Diff line number Diff line change @@ -2,3 +2,5 @@ yapf==0.23.0
2
2
twine==1.11.0
3
3
bumpversion==0.5.3
4
4
pytest==3.7.4
5
+ oss2==2.5.0
6
+ pycryptodome==3.6.6
Original file line number Diff line number Diff line change
1
+ import os
2
+ import sys
3
+ import ntpath
4
+ import glob
5
+ import configparser
6
+
7
+ import oss2
8
+
9
+ endpoint = 'http://{region}.aliyuncs.com' .format (region = 'oss-cn-shanghai' )
10
+
11
+ bucket_name = 'lc-frontend'
12
+
13
+ if __name__ == '__main__' :
14
+ if len (sys .argv ) >= 2 :
15
+ files = sys .argv [1 :]
16
+ else :
17
+ files = glob .glob ('build/lib/py_sourcemap/*.so' )
18
+
19
+ config = configparser .ConfigParser ()
20
+ config .read ('.bumpversion.cfg' )
21
+ package_version = config ['bumpversion' ]['current_version' ]
22
+
23
+ access_key = os .environ .get ('ALIYUN_ACCESS_KEY' )
24
+ access_token = os .environ .get ('ALIYUN_ACCESS_TOKEN' )
25
+
26
+ auth = oss2 .Auth (access_key , access_token )
27
+ bucket = oss2 .Bucket (auth , endpoint , bucket_name )
28
+
29
+ for file_path in files :
30
+ basename = ntpath .basename (file_path )
31
+ fp = open (file_path , 'rb' )
32
+ target_key = 'packages/py_sourcemap/{version}/{name}' .format (
33
+ version = package_version , name = basename )
34
+ print ('Uploading {}...' .format (target_key ))
35
+ bucket .put_object (target_key , fp .read ())
36
+ fp .close ()
37
+ print ('Uploaded all.' )
You can’t perform that action at this time.
0 commit comments