Skip to content

Commit

Permalink
Temp: Publish release
Browse files Browse the repository at this point in the history
  • Loading branch information
tylercreller committed Feb 6, 2024
1 parent 9df8a31 commit d270211
Showing 1 changed file with 65 additions and 65 deletions.
130 changes: 65 additions & 65 deletions .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,68 +87,68 @@ jobs:
# Build for the supported operating systems and architectures:
build("darwin", "amd64")
build("darwin", "arm64")
build("linux", "amd64")
build("linux", "arm64")
build("linux", "ppc64le")
build("linux", "s390x")
build("windows", "amd64")
# # Calculate the SHA256 digests:
# for asset in os.listdir(assets):
# digest = os.path.join(assets, f"{asset}.sha256")
# with open(digest, "wb") as stream:
# args = ["sha256sum", asset]
# subprocess.run(check=True, cwd=assets, stdout=stream, args=args)
# # Get the list of changes:
# body = ""
# with open("CHANGES.md", "r") as stream:
# while True:
# line = stream.readline()
# if line == "" or line.startswith("## " + version):
# break
# while True:
# line = stream.readline()
# if line == "" or line.startswith("## "):
# break
# body += line
# # Send the request to create the release:
# response = requests.post(
# headers={
# "Authorization": f"Bearer {token}",
# "Content-Type": "application/json",
# "Accept": "application/json",
# },
# json={
# "tag_name": f"v{version}",
# "name": f"Release {version}",
# "body": body,
# },
# url=(
# "https://api.github.com"
# f"/repos/{repository}/releases"
# ),
# )
# response.raise_for_status()
# # Get the release identifier:
# release = response.json()["id"]
# # Upload the assets:
# for asset in os.listdir(assets):
# file = os.path.join(assets, asset)
# with open(file, "rb") as stream:
# response = requests.post(
# headers={
# "Authorization": f"Bearer {token}",
# "Content-Type": "application/octet-stream",
# "Accept": "application/json",
# },
# data=stream,
# url=(
# "https://uploads.github.com"
# f"/repos/{repository}/releases/{release}/assets?name={asset}"
# ),
# )
# response.raise_for_status()
# build("linux", "amd64")
# build("linux", "arm64")
# build("linux", "ppc64le")
# build("linux", "s390x")
# build("windows", "amd64")
# Calculate the SHA256 digests:
for asset in os.listdir(assets):
digest = os.path.join(assets, f"{asset}.sha256")
with open(digest, "wb") as stream:
args = ["sha256sum", asset]
subprocess.run(check=True, cwd=assets, stdout=stream, args=args)
# Get the list of changes:
body = ""
with open("CHANGES.md", "r") as stream:
while True:
line = stream.readline()
if line == "" or line.startswith("## " + version):
break
while True:
line = stream.readline()
if line == "" or line.startswith("## "):
break
body += line
# Send the request to create the release:
response = requests.post(
headers={
"Authorization": f"Bearer {token}",
"Content-Type": "application/json",
"Accept": "application/json",
},
json={
"tag_name": f"v{version}",
"name": f"Release {version}",
"body": body,
},
url=(
"https://api.github.com"
f"/repos/{repository}/releases"
),
)
response.raise_for_status()
# Get the release identifier:
release = response.json()["id"]
# Upload the assets:
for asset in os.listdir(assets):
file = os.path.join(assets, asset)
with open(file, "rb") as stream:
response = requests.post(
headers={
"Authorization": f"Bearer {token}",
"Content-Type": "application/octet-stream",
"Accept": "application/json",
},
data=stream,
url=(
"https://uploads.github.com"
f"/repos/{repository}/releases/{release}/assets?name={asset}"
),
)
response.raise_for_status()

0 comments on commit d270211

Please sign in to comment.