workflows,scripts: migrate to use GITHUB_OUTPUT
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -44,7 +44,7 @@ jobs:
|
||||
- name: find location of global yarn cache
|
||||
id: yarn-cache
|
||||
if: steps.cache-modules.outputs.cache-hit != 'true'
|
||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: cache global yarn cache
|
||||
uses: actions/cache@v3
|
||||
|
||||
@@ -33,7 +33,7 @@ jobs:
|
||||
}
|
||||
|
||||
const prNumber = artifact.name.slice('pr_number-'.length)
|
||||
console.log(`::set-output name=pr-number::${prNumber}`);
|
||||
core.setOutput('pr-number', prNumber);
|
||||
|
||||
- uses: backstage/actions/re-review@v0.5.7
|
||||
with:
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
# also contains an "--config=.github/vale/config.ini" option
|
||||
- name: generate vale args
|
||||
id: generate
|
||||
run: echo "::set-output name=args::$(node scripts/check-docs-quality.js --ci-args)"
|
||||
run: echo "args=$(node scripts/check-docs-quality.js --ci-args)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: documentation quality check
|
||||
uses: errata-ai/vale-action@v2.0.1
|
||||
|
||||
@@ -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 => {
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
const { Octokit } = require('@octokit/rest');
|
||||
const path = require('path');
|
||||
const fs = require('fs-extra');
|
||||
const { EOL } = require('os');
|
||||
|
||||
const baseOptions = {
|
||||
owner: 'backstage',
|
||||
@@ -64,6 +65,9 @@ async function main() {
|
||||
if (!process.env.GITHUB_TOKEN) {
|
||||
throw new Error('GITHUB_TOKEN is not set');
|
||||
}
|
||||
if (!process.env.GITHUB_OUTPUT) {
|
||||
throw new Error('GITHUB_OUTPUT environment variable not set');
|
||||
}
|
||||
|
||||
const commitSha = process.env.GITHUB_SHA;
|
||||
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
|
||||
@@ -74,8 +78,11 @@ async function main() {
|
||||
console.log(`Creating release tag ${tagName} at ${commitSha}`);
|
||||
await createGitTag(octokit, commitSha, tagName);
|
||||
|
||||
console.log(`::set-output name=tag_name::${tagName}`);
|
||||
console.log(`::set-output name=version::${releaseVersion}`);
|
||||
await fs.appendFile(process.env.GITHUB_OUTPUT, `tag_name=${tagName}${EOL}`);
|
||||
await fs.appendFile(
|
||||
process.env.GITHUB_OUTPUT,
|
||||
`version=${releaseVersion}${EOL}`,
|
||||
);
|
||||
}
|
||||
|
||||
main().catch(error => {
|
||||
|
||||
Reference in New Issue
Block a user