workflows,scripts: migrate to use GITHUB_OUTPUT

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-11-22 17:15:37 +01:00
parent 017313d886
commit 609b5ce65b
5 changed files with 19 additions and 7 deletions
+7 -2
View File
@@ -28,6 +28,7 @@ const { execFile: execFileCb } = require('child_process');
const { resolve: resolvePath } = require('path');
const { promises: fs } = require('fs');
const { promisify } = require('util');
const { EOL } = require('os');
const parentRef = process.env.COMMIT_SHA_BEFORE || 'HEAD^';
@@ -53,6 +54,10 @@ async function runPlain(cmd, ...args) {
async function main() {
process.cwd(resolvePath(__dirname, '..'));
if (!process.env.GITHUB_OUTPUT) {
throw new Error('GITHUB_OUTPUT environment variable not set');
}
const diff = await runPlain(
'git',
'diff',
@@ -103,7 +108,7 @@ async function main() {
if (newVersions.length === 0) {
console.log('No package version bumps detected, no release needed');
console.log(`::set-output name=needs_release::false`);
await fs.appendFile(process.env.GITHUB_OUTPUT, `needs_release=false${EOL}`);
return;
}
@@ -114,7 +119,7 @@ async function main() {
` ${name.padEnd(maxLength, ' ')} ${oldVersion} to ${newVersion}`,
);
}
console.log(`::set-output name=needs_release::true`);
await fs.appendFile(process.env.GITHUB_OUTPUT, `needs_release=true${EOL}`);
}
main().catch(error => {