Skip to content

Commit 8569bc2

Browse files
committed
Set a returncode to reflect errors when uploading artifacts
1 parent ea243f3 commit 8569bc2

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

publish.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ def _call(self, *args, **kwargs):
135135
subprocess.check_call(args)
136136
except subprocess.CalledProcessError:
137137
print(msg, file=sys.stderr)
138+
raise
138139

139140
def github_release(self):
140141
"""Create release in github, and upload artifacts and changelog"""
@@ -216,8 +217,13 @@ def publish(options):
216217
changelog = repo.generate_changelog()
217218
artifacts = create_artifacts(changelog, options)
218219
uploader = Uploader(options, repo.version, changelog, artifacts)
219-
uploader.github_release()
220-
uploader.pypi_release()
220+
return_code = 0
221+
for i, release in enumerate((uploader.github_release, uploader.pypi_release)):
222+
try:
223+
release()
224+
except subprocess.CalledProcessError:
225+
return_code |= pow(2, i)
226+
return return_code
221227

222228

223229
def main():
@@ -228,7 +234,7 @@ def main():
228234
parser.add_argument("organization", help="Github organization")
229235
parser.add_argument("repository", help="The repository")
230236
options = parser.parse_args()
231-
publish(options)
237+
sys.exit(publish(options))
232238

233239

234240
if __name__ == "__main__":

0 commit comments

Comments
 (0)