support not uploading assets, through 'files: none'

This commit is contained in:
eine
2021-01-12 20:41:15 +01:00
parent 86bdfdbb1b
commit 0b4083dfda
2 changed files with 21 additions and 15 deletions

View File

@@ -51,6 +51,8 @@ Token to make authenticated API calls; can be passed in using `{{ secrets.GITHUB
Either a single filename/pattern or a multi-line list can be provided. All the artifacts are uploaded regardless of the hierarchy. Either a single filename/pattern or a multi-line list can be provided. All the artifacts are uploaded regardless of the hierarchy.
For creating/updating a release without uploading assets, set `files: none`.
## tag ## tag
The default tag name for the tip/nightly pre-release is `tip`, but it can be optionally overriden through option `tag`. The default tag name for the tip/nightly pre-release is `tip`, but it can be optionally overriden through option `tag`.

12
tip.py
View File

@@ -20,11 +20,15 @@ if 'INPUT_FILES' in environ:
if len(argv) > 1: if len(argv) > 1:
args = args + argv[1:] args = args + argv[1:]
if len(args) == 0: if len(args) == 1 and args[0] == 'none':
files = []
print("! Skipping 'files' because it's set to 'none")
else:
if len(args) == 0:
stdout.flush() stdout.flush()
raise(Exception("Glob patterns need to be provided as positional arguments or through envvar 'INPUT_FILES'!")) raise(Exception("Glob patterns need to be provided as positional arguments or through envvar 'INPUT_FILES'!"))
for item in args: for item in args:
items = [fname for fname in glob(item, recursive=True) if not Path(fname).is_dir()] items = [fname for fname in glob(item, recursive=True) if not Path(fname).is_dir()]
print("glob(%s)" % item, "->", items) print("glob(%s)" % item, "->", items)
for fname in items: for fname in items:
@@ -33,7 +37,7 @@ for item in args:
continue continue
files += [fname] files += [fname]
if len(files) < 1: if len(files) < 1:
stdout.flush() stdout.flush()
raise(Exception('Empty list of files to upload/update!')) raise(Exception('Empty list of files to upload/update!'))
@@ -110,7 +114,7 @@ else:
except Exception as e: except Exception as e:
raise(Exception(err_msg)) raise(Exception(err_msg))
print("· Upload artifacts") print("· Cleanup and/or upload artifacts")
artifacts = files artifacts = files