diff --git a/releaser/releaser.py b/releaser/releaser.py index eb5a181..f001ad3 100755 --- a/releaser/releaser.py +++ b/releaser/releaser.py @@ -52,7 +52,7 @@ def GetListOfArtifacts(argv, files): if len(argv) > 1: args += argv[1:] if len(args) == 1 and args[0].lower() == "none": - print("! Skipping 'files' because it's set to 'none") + print("! Skipping 'files' because it's set to 'none'.") return [] elif len(args) == 0: stdout.flush() @@ -63,7 +63,7 @@ def GetListOfArtifacts(argv, files): print(f" glob({item!s}):") for fname in [fname for fname in glob(item, recursive=True) if not Path(fname).is_dir()]: if Path(fname).stat().st_size == 0: - print(f" - ! Skipping empty file {fname!s}") + print(f" - ! Skipping empty file {fname!s}.") continue print(f" - {fname!s}") flist.append(fname) @@ -101,7 +101,7 @@ def CheckRefSemVer(gh_ref, tag, snapshots): return (tag, env_tag, False) elif snapshots: # is semver compilant prerelease tag, thus a snapshot (we skip it) - print("! Skipping snapshot prerelease") + print("! Skipping snapshot prerelease.") sys_exit() return (tag, env_tag, True) @@ -179,12 +179,15 @@ if paramRM: asset.delete_asset() stdout.flush() -print("· Cleanup and/or upload artifacts") -env = environ.copy() -env["GITHUB_TOKEN"] = paramToken -cmd = ["gh", "release", "upload", "--repo", paramRepo, "--clobber", tag] + files -print(f" > {' '.join(cmd)}") -check_call(cmd, env=env) -stdout.flush() +if len(files) > 0: + print("· Upload assets") + env = environ.copy() + env["GITHUB_TOKEN"] = paramToken + cmd = ["gh", "release", "upload", "--repo", paramRepo, "--clobber", tag] + files + print(f" > {' '.join(cmd)}") + check_call(cmd, env=env) + stdout.flush() +else: + print("! Skipping uploading assets because the file list is empty.") UpdateReference(gh_release, tag, paramSHA if env_tag is None else None, is_prerelease, is_draft) diff --git a/with-post-step/main.js b/with-post-step/main.js index 1a9c3f0..04c2a9d 100644 --- a/with-post-step/main.js +++ b/with-post-step/main.js @@ -26,7 +26,8 @@ * * https://github.com/actions/runner/issues/1478 * * ================================================================================================================== */ const { spawn } = require("child_process"); -const fs = require('fs'); +const { appendFileSync } = require("fs"); +const { EOL } = require("os"); function run(cmd) { const subprocess = spawn(cmd, { stdio: "inherit", shell: true }); @@ -40,6 +41,6 @@ const key = process.env.INPUT_KEY.toUpperCase(); if ( process.env[`STATE_${key}`] !== undefined ) { // Are we in the 'post' step? run(process.env.INPUT_POST); } else { // Otherwise, this is the main step - fs.appendFileSync(process.env.GITHUB_STATE, `${key}=true`); + appendFileSync(process.env.GITHUB_STATE, `${key}=true${EOL}`); run(process.env.INPUT_MAIN); }