mirror of
https://github.com/pyTooling/Actions.git
synced 2026-02-12 02:56:56 +08:00
releaser: refactor; add func UpdateReference
This commit is contained in:
@@ -196,10 +196,11 @@ for artifact in artifacts:
|
||||
print(f" > {artifact!s}:\n - uploading...")
|
||||
gh_release.upload_asset(artifact)
|
||||
|
||||
stdout.flush()
|
||||
print("· Update Release reference (force-push tag)")
|
||||
|
||||
if is_draft:
|
||||
def UpdateReference(gh_release, tag, sha, is_prerelease, is_draft):
|
||||
print("· Update Release reference (force-push tag)")
|
||||
|
||||
if is_draft:
|
||||
# Unfortunately, it seems not possible to update fields 'created_at' or 'published_at'.
|
||||
print(" > Update (pre-)release")
|
||||
gh_release.update_release(
|
||||
@@ -211,7 +212,16 @@ if is_draft:
|
||||
target_commitish=gh_release.target_commitish,
|
||||
)
|
||||
|
||||
if ("GITHUB_SHA" in environ) and (env_tag is None):
|
||||
sha = environ["GITHUB_SHA"]
|
||||
if sha is not None:
|
||||
print(f" > Force-push '{tag!s}' to {sha!s}")
|
||||
gh_repo.get_git_ref(f"tags/{tag!s}").edit(sha)
|
||||
|
||||
|
||||
stdout.flush()
|
||||
UpdateReference(
|
||||
gh_release,
|
||||
tag,
|
||||
getenv("GITHUB_SHA", None) if env_tag is None else None,
|
||||
is_prerelease,
|
||||
is_draft
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user