Compare commits

...

7 Commits

Author SHA1 Message Date
umarcor
adef08d3bd v0.4.6 2023-02-26 17:44:46 +01:00
umarcor
191a6471ed releaser: fix creating a release with no assets 2023-02-26 15:42:43 +01:00
Patrick Lehmann
3ae8451cc0 Merge pull request #61 from antoineco/fix-eol
Append EOL after value in GITHUB_STATE
2023-01-27 20:05:35 +01:00
Antoine Cotten
f4951ec52e fix: append EOL after value in GITHUB_STATE 2023-01-27 18:49:49 +01:00
Unai Martinez-Corral
cc576ce25a v0.4.5 (#58) 2022-11-08 02:24:19 +00:00
Unai Martinez-Corral
decf16ff8f with-post-step: update copyright header 2022-11-08 03:21:27 +01:00
Unai Martinez-Corral
9faa1459c9 with-post-step: use option 'shell: true' by default and do not split args
This fixes a breaking change introduced in #46.
'exec' executes commands on the shell by default, while 'spawn' does not.
2022-11-08 03:15:19 +01:00
2 changed files with 20 additions and 18 deletions

View File

@@ -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)

View File

@@ -3,7 +3,8 @@
* Unai Martinez-Corral *
* *
* ================================================================================================================== *
* Copyright 2021 Unai Martinez-Corral <unai.martinezcorral@ehu.eus> *
* Copyright 2021-2022 Unai Martinez-Corral <unai.martinezcorral@ehu.eus> *
* Copyright 2022 Unai Martinez-Corral <umartinezcorral@antmicro.com> *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
@@ -25,13 +26,11 @@
* * 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(cmdline) {
var args = cmdline.split(" ");
const cmd = args.shift();
const subprocess = spawn(cmd, args, { stdio: "inherit" });
function run(cmd) {
const subprocess = spawn(cmd, { stdio: "inherit", shell: true });
subprocess.on("exit", (exitCode) => {
process.exitCode = exitCode;
});
@@ -42,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);
}