-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.py
More file actions
34 lines (28 loc) · 1004 Bytes
/
release.py
File metadata and controls
34 lines (28 loc) · 1004 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# -*- coding:utf-8 -*-
import sys
import configparser
from functools import partial
from subprocess import check_call as _call
from ack.settings import DEBUG
call = partial(_call, shell=True)
def main():
"""
手工 build 镜像临时用这个脚本, python release.py patch
集成cicd后,本脚本会更新
:return:
"""
part = sys.argv[1]
call(f"bumpversion --allow-dirty {part}")
config = configparser.ConfigParser()
config.read(".bumpversion.cfg")
version = config.get("bumpversion", "current_version")
environment = "test" if DEBUG else "prod"
image_name_base = f"registry.cn-shenzhen.aliyuncs.com/gsmini/ack-{environment}"
image_version = f"{image_name_base}:{version}"
image_latest = f"{image_name_base}:latest"
call(f"docker build -t {image_version} .")
call(f"docker tag {image_version} {image_latest}")
call(f"docker push {image_version}")
call(f"docker push {image_latest}")
if __name__ == "__main__":
main()