Skip to content

Commit

Permalink
update deploy to remove set-output
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed Feb 2, 2023
1 parent 7c4c72d commit b12f099
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion scripts/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,21 @@ def read_json(filename):
sys.exit("A ZENODO_TOKEN is required to be exported in the environment!")


def set_env_and_output(name, value):
"""helper function to echo a key/value pair to the environement file
Parameters:
name (str) : the name of the environment variable
value (str) : the value to write to file
"""
for env_var in ("GITHUB_ENV", "GITHUB_OUTPUT"):
environment_file_path = os.environ.get(env_var)
print("Writing %s=%s to %s" % (name, value, env_var))

with open(environment_file_path, "a") as environment_file:
environment_file.write("%s=%s\n" % (name, value))


class Zenodo:
"""
Zenodo client to handle shared API calls.
Expand Down Expand Up @@ -190,7 +205,7 @@ def publish(self, data):
print(json.dumps(published, indent=4))
print("::endgroup::")
for k, v in published["links"].items():
print("::set-output name=%s::%s" % (k, v))
set_env_and_output(k, v)

def upload_metadata(self, upload, zenodo_json, version):
"""
Expand Down

0 comments on commit b12f099

Please sign in to comment.