Skip to content

Commit

Permalink
GH-21: Workflow experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
negrutiu committed Jun 8, 2024
1 parent a32135f commit 5930f43
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ jobs:
lines = []
with open(".github/workflows/release-body.md") as fin:
line = fin.read()
line = line.replace('{version-cacert}', '${{fromJson(needs.build.outputs.versions_json).cacert}}')
line = line.replace('{version-engines}', '${{fromJson(needs.build.outputs.versions_json).curl_md}}')
line = line.replace('{version-gcc}', '${{fromJson(needs.build.outputs.versions_json).gcc}}')
line = line.replace('{url-workflow}', 'https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}')
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-body.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## Release Notes

* {version-engines}
* {version-engines}, `cacert/{cacert}`
* Built with mingw-w64 `gcc/{version-gcc}`
* GitHub workflow run: {url-workflow}
* Contains `amd64-unicode`, `x86-unicode`, `x86-ansi` binaries
Expand Down
12 changes: 12 additions & 0 deletions _versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from subprocess import Popen, PIPE
import re
import json
from datetime import datetime

def get_resource_version(filename):
with open(filename, 'rb') as fin:
Expand Down Expand Up @@ -69,6 +70,16 @@ def get_curl_versions(curlPath, markdown=False):
versions += f"{name}/{version} "
return versions.removesuffix(', ')

def get_cacert_version():
with open('src/nscurl/curl-ca-bundle.crt', 'rb') as fin:
for line in fin.read().decode('utf-8').split("\n"):
if line.startswith("## Certificate data from Mozilla as of: "):
datestr = line.removeprefix('## Certificate data from Mozilla as of: ')
# example: "Mon Mar 11 15:25:27 2024 GMT"
date = datetime.strptime(datestr, '%c GMT')
return "{:%Y-%m-%d}".format(date)
return ""

parser = argparse.ArgumentParser()
parser.add_argument("-c", "--curl", type=str, default="curl.exe")
parser.add_argument("-g", "--gcc", type=str, default="gcc.exe")
Expand All @@ -81,5 +92,6 @@ def get_curl_versions(curlPath, markdown=False):
"curl_md": get_curl_versions(args.curl, True),
"engines": get_curl_engines_versions(args.curl),
"gcc": get_gcc_version(args.gcc),
"cacert": get_cacert_version(),
}
print(json.dumps(versions, indent=args.indent))

0 comments on commit 5930f43

Please sign in to comment.