Skip to content

Commit 203716d

Browse files
authored
Merge pull request #5 from withastro/fix/use-env
pass output using env
2 parents fcdc742 + bd8049e commit 203716d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

action.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ inputs:
1313
description: "If not automatically detectable, you may specify your preferred package manager"
1414
required: false
1515
default: ""
16-
outputs:
17-
package-manager:
18-
description: "detected package manager"
19-
value: ${{ steps.lockfile.outputs.package-manager }}
2016

2117
runs:
2218
using: composite
@@ -29,36 +25,40 @@ runs:
2925
run: |
3026
len=`echo $INPUT_PM | wc -c`
3127
if [ $len -gt 1 ]; then
32-
echo "'::set-output name=package-manager::$INPUT_PM'"
28+
echo "'::set-output name=PACKAGE_MANAGER::$INPUT_PM'"
3329
elif [ $(find "." -name "pnpm-lock.yaml") ]; then
34-
echo "'::set-output name=package-manager::pnpm'"
30+
echo "'::set-output name=PACKAGE_MANAGER::pnpm'"
3531
elif [ $(find "." -name "yarn.lock") ]; then
36-
echo "'::set-output name=package-manager::yarn'"
32+
echo "'::set-output name=PACKAGE_MANAGER::yarn'"
3733
elif [ $(find "." -name "package-lock.json") ]; then
38-
echo "'::set-output name=package-manager::npm'"
34+
echo "'::set-output name=PACKAGE_MANAGER::npm'"
3935
else
4036
echo "No lockfile found.
4137
Please specify your preferred \"package-manager\" in the action configuration."
4238
exit 1
4339
fi
4440
4541
- name: Setup PNPM
46-
if: ${{ outputs.package-manager.value == 'pnpm' }}
42+
if: ${{ steps.lockfile.output.pm == 'pnpm' }}
4743
uses: pnpm/[email protected]
4844

4945
- name: Setup Node
5046
uses: actions/setup-node@v3
5147
with:
5248
node-version: ${{ inputs.node-version }}
53-
cache: ${{ outputs.package-manager.value }}
49+
cache: ${{ steps.lockfile.outputs.PACKAGE_MANAGER }}
5450

5551
- name: Install
5652
shell: "bash"
57-
run: ${{ outputs.package-manager.value }} install
53+
env:
54+
PACKAGE_MANAGER: ${{ steps.lockfile.outputs.PACKAGE_MANAGER }}
55+
run: $PACKAGE_MANAGER install
5856

5957
- name: Build
6058
shell: "bash"
61-
run: ${{ outputs.package-manager.value }} run build
59+
env:
60+
PACKAGE_MANAGER: ${{ steps.lockfile.outputs.PACKAGE_MANAGER }}
61+
run: $PACKAGE_MANAGER run build
6262

6363
- name: Upload Pages Artifact
6464
uses: actions/upload-pages-artifact@v1

0 commit comments

Comments
 (0)