Stop using deprecated set-output GH Actions command (#5876)

This commit is contained in:
Jakub Kuczys 2022-11-11 15:12:54 +01:00 committed by GitHub
parent 3f749b840f
commit 0f20f15c26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,13 +1,20 @@
import os import os
import re import re
import sys import sys
from typing import Match from typing import Any, Match
import redbot import redbot
GITHUB_OUTPUT = os.environ["GITHUB_OUTPUT"]
def set_output(name: str, value: Any) -> None:
with open(GITHUB_OUTPUT, "a", encoding="utf-8") as fp:
fp.write(f"{name}={value}\n")
if int(os.environ.get("JUST_RETURN_VERSION", 0)): if int(os.environ.get("JUST_RETURN_VERSION", 0)):
print(f"::set-output name=version::{redbot._VERSION}") set_output("version", redbot._VERSION)
sys.exit(0) sys.exit(0)
@ -17,7 +24,7 @@ version_info = None
def repl(match: Match[str]) -> str: def repl(match: Match[str]) -> str:
global version_info global version_info
print(f"::set-output name=old_version::{match.group('version')}") set_output("old_version", match.group("version"))
new_stable_version = os.environ.get("NEW_STABLE_VERSION", "auto") new_stable_version = os.environ.get("NEW_STABLE_VERSION", "auto")
if new_stable_version == "auto": if new_stable_version == "auto":
@ -49,4 +56,4 @@ if not found:
with open("redbot/__init__.py", "w", encoding="utf-8", newline="\n") as fp: with open("redbot/__init__.py", "w", encoding="utf-8", newline="\n") as fp:
fp.write(new_contents) fp.write(new_contents)
print(f"::set-output name=new_version::{version_info}") set_output("new_version", version_info)