mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-04-24 03:29:57 -07:00
New release workflow
This commit is contained in:
21
.github/workflow_data/release.py
vendored
21
.github/workflow_data/release.py
vendored
@@ -1,20 +1,27 @@
|
||||
#!/usr/bin/env python
|
||||
import requests
|
||||
import json
|
||||
import os
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open(os.environ["GITHUB_EVENT_PATH"], "r") as f:
|
||||
event = json.load(f)
|
||||
release = requests.get(
|
||||
event["release"]["url"],
|
||||
headers={
|
||||
"Accept": "application/vnd.github.v3+json",
|
||||
"Authorization": f"token {os.environ['GITHUB_TOKEN']}"
|
||||
}
|
||||
).json()
|
||||
version_tag = release["tag_name"]
|
||||
changelog = release["body"]
|
||||
|
||||
notes_path = '.github/workflow_data/release.md'
|
||||
with open(os.environ['GITHUB_EVENT_PATH'], "r") as f:
|
||||
changelog = json.load(f)['pull_request']['body']
|
||||
with open(notes_path, "r") as f:
|
||||
template = f.read()
|
||||
notes = template.format(
|
||||
ARTIFACT_TGZ=os.environ['ARTIFACT_TGZ'],
|
||||
ARTIFACT_ZIP=os.environ['ARTIFACT_ZIP'],
|
||||
VERSION_TAG=os.environ['VERSION_TAG'],
|
||||
VERSION_TAG=version_tag,
|
||||
CHANGELOG=changelog
|
||||
)
|
||||
with open(notes_path, "w") as f:
|
||||
f.write(notes)
|
||||
with open(os.environ["ARTIFACT_TGZ"].removesuffix(".tgz") + ".md", "w") as f:
|
||||
f.write(changelog.strip() + "\n\n")
|
||||
|
||||
Reference in New Issue
Block a user