Skip to content

Commit

Permalink
Upload jar files to GitHub after completion
Browse files Browse the repository at this point in the history
  • Loading branch information
DAMcraft committed Dec 19, 2023
1 parent 004c0f2 commit 9d5cc29
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/prerelease.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def main():
old_release = get_tags.json()
release_id = old_release['id']
del_req = requests.delete(
f"https://api.github.com/repos/DAMcraft/MeteorServerSeeker/releases/latest",
f"https://api.github.com/repos/DAMcraft/MeteorServerSeeker/releases/{release_id}",
headers={
"Authorization": f"Bearer {GITHUB_TOKEN}"
}
Expand All @@ -80,6 +80,18 @@ def main():
}
)
print(req.json())
release_id = req.json()['id']

# Upload jar
upload_req = requests.post(
f"https://uploads.github.com/repos/DAMcraft/MeteorServerSeeker/releases/{release_id}/assets?name={jar}",
headers={
'Authorization': f'Bearer {GITHUB_TOKEN}',
'Content-Type': 'application/jar'
},
data=open(f'./build/libs/{jar}', 'rb')
)
print(upload_req.json())

if DISCORD_WEBHOOK is not None:
requests.post(
Expand Down

0 comments on commit 9d5cc29

Please sign in to comment.