Skip to content

Commit

Permalink
Merge pull request #9 from johrstrom/fix-issues
Browse files Browse the repository at this point in the history
Fix some issues.
  • Loading branch information
vsoch authored Feb 2, 2024
2 parents b12f099 + 1431eda commit ff87341
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions scripts/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,7 @@ def update_doi(self, doi):
draft = target_deposit
else:
# found the existing deposit - so let's make a new version.
response = self.post(
"%s/actions/newversion" % target_deposit["links"]["self"]
)
response = self.post(target_deposit["links"]["newversion"])
if response.status_code not in [200, 201]:
sys.exit(
"Cannot create a new version for doi '%s'. %s"
Expand Down Expand Up @@ -188,8 +186,11 @@ def upload_archive(self, upload, archive):
data=fp,
params=self.params,
)
if response.status_code != 200:
sys.exit("Trouble uploading artifact %s to bucket" % archive)
if response.status_code not in [200, 201]:
sys.exit(
"Trouble uploading artifact %s to bucket with response code %s" %
archive, response.status_code
)

def publish(self, data):
"""
Expand Down Expand Up @@ -219,7 +220,7 @@ def upload_metadata(self, upload, zenodo_json, version):
if zenodo_json:
metadata.update(read_json(zenodo_json))
metadata["version"] = version
metadata["publication_date"] = str(datetime.now())
metadata["publication_date"] = str(datetime.today().strftime('%Y-%m-%d'))

# New .zenodo.json may be missing this
if "upload_type" not in metadata:
Expand Down

0 comments on commit ff87341

Please sign in to comment.