5 from fs.osfs
import OSFS
6 from markdown
import markdown
as mdlib
10 from util
import smtp, def_arguments, get_lxplus_fs, Spinner, gitlab
11 from release_notes
import collect_milestone, make_release_notes, parse_version
13 sender_email =
"Acts Bot <atsjenkins@cern.ch>"
14 receiver_email = os.getenv(
"TAG_DEPLOY_EMAIL_RECEIVERS")
16 from email.mime.text
import MIMEText
17 from email.mime.multipart
import MIMEMultipart
21 return mdlib(md, extensions=[
"pymdownx.extra"])
25 p = argparse.ArgumentParser()
28 p.add_argument(
"--doc-source", required=
True)
29 p.add_argument(
"--dry-run", action=
"store_true")
31 "--ref", default=os.getenv(
"CI_COMMIT_REF_NAME",
None), required=
True
35 default=os.getenv(
"DOC_WEBSITE_ROOT",
"/eos/user/a/atsjenkins/www/ACTS/"),
39 default=os.getenv(
"DOC_WEBSITE_URL",
"https://acts.web.cern.ch/ACTS/"),
44 src_fs = OSFS(os.path.abspath(args.doc_source))
46 www_fs =
get_lxplus_fs(args).opendir(os.path.join(args.doc_root))
48 if not www_fs.exists(args.ref):
49 www_fs.makedirs(os.path.join(args.ref,
"doc"))
50 refdir = www_fs.opendir(os.path.join(args.ref,
"doc"))
55 os.path.abspath(args.doc_source),
57 os.path.join(args.doc_root, args.ref,
"doc"),
59 with
Spinner(f
"Publishing doc for {args.ref}"):
61 fs.copy.copy_dir(src_fs,
".", refdir,
".")
63 doc_url = os.path.join(args.doc_public_url, args.ref,
"doc")
64 print(
"Doc is available at", doc_url)
68 with www_fs.open(
"latest_release.json",
"w")
as f:
69 json.dump({
"subject":
"release",
"status": args.ref,
"color":
"yellow"}, f)
72 project = gl.projects.get(
"acts/acts-core")
75 with
Spinner(text=
"Loading milestone"):
76 milestones = project.milestones.list(all=
True)
79 if ms.title == version:
85 message = MIMEMultipart(
"alternative")
86 message[
"Subject"] = f
"New Acts release: {args.ref}"
87 message[
"From"] = sender_email
88 message[
"To"] = receiver_email
91 Dear Acts enthusiasts,
93 a new tag '{ref}' of the Acts project has been created.
95 You can get the source code from git using:
97 git clone https://gitlab.cern.ch/acts/acts-core.git
101 or download a tarball with the source from
103 https://gitlab.cern.ch/acts/acts-core/-/archive/{ref}/acts-core-{ref}.tar.gz
105 The documentation is deployed at
106 https://acts.web.cern.ch/ACTS/{ref}/doc/index.html
109 your friendly Acts robot
111 text = textwrap.dedent(text).format(ref=args.ref, relnotes=relnotes)
114 Dear Acts enthusiasts,
116 a new tag of the Acts project has been created.
121 [![](https://badgen.net/badge/release/{ref}/yellow)](https://gitlab.cern.ch/acts/acts-core/tags/{ref})
126 You can get the source code from git using:
129 git clone https://gitlab.cern.ch/acts/acts-core.git
134 or download a tarball with the source from
136 https://gitlab.cern.ch/acts/acts-core/-/archive/{ref}/acts-core-{ref}.tar.gz
138 The documentation is deployed at
140 https://acts.web.cern.ch/ACTS/{ref}/doc/index.html
143 your friendly Acts robot
146 md = textwrap.dedent(md).format(ref=args.ref, relnotes=relnotes)
160 part1 = MIMEText(text,
"plain")
161 part2 = MIMEText(html,
"html")
163 message.attach(part1)
164 message.attach(part2)
168 with
smtp(args)
as server:
169 server.sendmail(sender_email, receiver_email, message.as_string())
172 if "__main__" == __name__: