Skip to content

CI: replace deprecated set-output command with GITHUB_ENV #5734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,13 @@ jobs:
run: opam exec -- node scripts/ciTest.js -mocha -theme -format

- name: Get artifact info
id: get_artifact_info
run: node .github/workflows/get_artifact_info.js

- name: "Upload artifacts: binaries"
uses: actions/upload-artifact@v3
with:
name: ${{ steps.get_artifact_info.outputs.artifact_name }}
path: ${{ steps.get_artifact_info.outputs.artifact_path }}
name: ${{ env.artifact_name }}
path: ${{ env.artifact_path }}

- name: "Upload artifacts: lib/ocaml"
if: runner.os == 'Linux'
Expand Down Expand Up @@ -140,7 +139,6 @@ jobs:
working-directory: packages/std

- name: Get package info
id: get_package_info
# For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit.
run: node .github/workflows/get_package_info.js ${{ github.event.pull_request.head.sha }}

Expand All @@ -149,8 +147,8 @@ jobs:
with:
name: npm-packages
path: |
${{ steps.get_package_info.outputs.rescript_package }}
${{ steps.get_package_info.outputs.stdlib_package }}
${{ env.rescript_package }}
${{ env.stdlib_package }}

installationTest:
needs: package
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/get_artifact_info.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
const fs = require("fs");
const os = require("os");

const artifactPath =
process.platform === "darwin" && process.arch === "arm64"
? process.platform + process.arch
Expand All @@ -6,5 +9,7 @@ const artifactPath =
const artifactName = "binaries-" + artifactPath;

// Pass artifactPath and artifactName to subsequent GitHub actions
console.log(`::set-output name=artifact_path::${artifactPath}`);
console.log(`::set-output name=artifact_name::${artifactName}`);
fs.appendFileSync(
process.env.GITHUB_ENV,
`artifact_path=${artifactPath}${os.EOL}artifact_name=${artifactName}${os.EOL}`
);
7 changes: 5 additions & 2 deletions .github/workflows/get_package_info.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const fs = require("fs");
const os = require("os");

const packageSpec = JSON.parse(fs.readFileSync("./package.json", "utf8"));
const { name, version } = packageSpec;
Expand All @@ -16,5 +17,7 @@ fs.renameSync(rescriptPackagePath, rescriptArtifactName);
fs.renameSync(stdlibPackagePath, stdlibArtifactName);

// Pass information to subsequent GitHub actions
console.log(`::set-output name=rescript_package::${rescriptArtifactName}`);
console.log(`::set-output name=stdlib_package::${stdlibArtifactName}`);
fs.appendFileSync(
process.env.GITHUB_ENV,
`rescript_package=${rescriptArtifactName}${os.EOL}stdlib_package=${stdlibArtifactName}${os.EOL}`
);