Skip to content
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

ci: set output has been updated to use GITHUB_OUTPUT #1726 #1727

Merged
merged 4 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .github/workflows/lighthouse-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
)
id: should_run
name: Should Run
run: echo "::set-output name=shouldrun::true"
run: echo "shouldrun=true" >> $GITHUB_OUTPUT

- if: steps.should_run.outputs.shouldrun == 'true'
uses: actions/checkout@v3
Expand Down
11 changes: 9 additions & 2 deletions pages/blog/automated-releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,9 @@ To share the output, you must assign an `id` to the step and declare a variable
```yaml
- name: Get version from package.json after release step
id: extractver
run: echo "::set-output name=version::$(npm run get-version --silent)"
run: |
npm run get-version --silent
echo "version=$(npm run get-version --silent)" >> $GITHUB_ENV
Copy link
Member

@anshgoyalevil anshgoyalevil May 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done @SumantxD
Was just wondering if that should be $GITHUB_ENV or $GITHUB_OUTPUT. Maybe the later one should be there.

Additionally, I think the command npm run get-version --silent is redundant here 🛩️

```

You can access the shared value by the `id` and a variable name like `steps.extractver.outputs.version`. We use it, for example, in the condition that specifies if further steps of the workflow should be triggered or not. If the version in `package.json` changed after GitHub and NPM step, this means we should proceed with Docker publishing and pull request creation:
Expand Down Expand Up @@ -228,9 +230,14 @@ jobs:
node-version: 13
- name: Install dependencies
run: npm ci

- name: Get version from package.json before release step
id: initversion
run: echo "::set-output name=version::$(npm run get-version --silent)"
run: npm run get-version --silent

- name: Set output
run: echo "version=$(npm run get-version --silent)" >> $GITHUB_OUTPUT

- name: Release to NPM and GitHub
id: release
env:
Expand Down