Added missing MIME type header in release script
This commit is contained in:
parent
566d1efdd6
commit
54ca432ee7
1 changed files with 7 additions and 10 deletions
|
@ -10,10 +10,6 @@ import http.client
|
|||
from urllib.error import HTTPError
|
||||
|
||||
|
||||
encoder = json.encoder.JSONEncoder()
|
||||
decoder = json.decoder.JSONDecoder()
|
||||
|
||||
|
||||
def parse_changelog(tag: str) -> Optional[str]:
|
||||
release_changelog: str = ''
|
||||
with open('CHANGELOG.md', 'r') as f:
|
||||
|
@ -45,13 +41,13 @@ def fetch_job_ids(project_id: int, pipeline_id: int, api_token: str) -> Dict[str
|
|||
print(e.read().decode())
|
||||
sys.exit(1)
|
||||
resp_data: bytes = resp.read()
|
||||
joblist: List[Dict[str, Any]] = decoder.decode(resp_data.decode())
|
||||
joblist: List[Dict[str, Any]] = json.loads(resp_data.decode())
|
||||
|
||||
jobidmap: Dict[str, str] = {}
|
||||
for job in joblist:
|
||||
name: str = job['name']
|
||||
id: str = job['id']
|
||||
jobidmap[name] = id
|
||||
job_id: str = job['id']
|
||||
jobidmap[name] = job_id
|
||||
return jobidmap
|
||||
|
||||
|
||||
|
@ -136,12 +132,13 @@ def main():
|
|||
- [Arch Linux Package]({arch_url}) ([sha256]({arch_sha_url}))
|
||||
- Docker image: registry.gitlab.com/{project_name}:{release_tag}'''
|
||||
|
||||
post_body: str = encoder.encode({'description': augmented_changelog})
|
||||
post_body: str = json.dumps({'description': augmented_changelog})
|
||||
|
||||
gitlab_release_api_url: str = \
|
||||
f'https://gitlab.com/api/v4/projects/{project_id}/repository/tags/{release_tag}/release'
|
||||
headers: Dict[str, str] = {
|
||||
'Private-Token': api_token
|
||||
'Private-Token': api_token,
|
||||
'Content-Type': 'application/json; charset=utf-8'
|
||||
}
|
||||
|
||||
request = urllib.request.Request(
|
||||
|
@ -157,7 +154,7 @@ def main():
|
|||
sys.exit(1)
|
||||
response_bytes: bytes = response.read()
|
||||
response_str: str = response_bytes.decode()
|
||||
response_data: Dict[str, Any] = decoder.decode(response_str)
|
||||
response_data: Dict[str, Any] = json.loads(response_str)
|
||||
|
||||
if response_data['tag_name'] != release_tag:
|
||||
print('Something went wrong...', file=sys.stderr)
|
||||
|
|
Loading…
Reference in a new issue