Skip to content

Commit 16c8ae6

Browse files
authored
Merge pull request #6 from withastro/fix/try-both
use ::set-output and github env
2 parents 203716d + 08fe816 commit 16c8ae6

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

action.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,25 @@ runs:
2525
run: |
2626
len=`echo $INPUT_PM | wc -c`
2727
if [ $len -gt 1 ]; then
28-
echo "'::set-output name=PACKAGE_MANAGER::$INPUT_PM'"
29-
elif [ $(find "." -name "pnpm-lock.yaml") ]; then
30-
echo "'::set-output name=PACKAGE_MANAGER::pnpm'"
28+
echo "::set-output name=PACKAGE_MANAGER::$INPUT_PM"
29+
echo "node_pm=$INPUT_PM" >> $GITHUB_ENV
30+
elif [ $(find "." -name "pnpm-lock.yaml") ]; then
31+
echo "::set-output name=PACKAGE_MANAGER::pnpm"
32+
echo "node_pm=pnpm" >> $GITHUB_ENV
3133
elif [ $(find "." -name "yarn.lock") ]; then
32-
echo "'::set-output name=PACKAGE_MANAGER::yarn'"
34+
echo "::set-output name=PACKAGE_MANAGER::yarn"
35+
echo "node_pm=yarn" >> $GITHUB_ENV
3336
elif [ $(find "." -name "package-lock.json") ]; then
34-
echo "'::set-output name=PACKAGE_MANAGER::npm'"
37+
echo "::set-output name=PACKAGE_MANAGER::npm"
38+
echo "node_pm=npm" >> $GITHUB_ENV
3539
else
3640
echo "No lockfile found.
3741
Please specify your preferred \"package-manager\" in the action configuration."
3842
exit 1
3943
fi
4044
4145
- name: Setup PNPM
42-
if: ${{ steps.lockfile.output.pm == 'pnpm' }}
46+
if: ${{ steps.lockfile.outputs.pm == 'pnpm' }}
4347
uses: pnpm/[email protected]
4448

4549
- name: Setup Node
@@ -50,15 +54,13 @@ runs:
5054

5155
- name: Install
5256
shell: "bash"
53-
env:
54-
PACKAGE_MANAGER: ${{ steps.lockfile.outputs.PACKAGE_MANAGER }}
55-
run: $PACKAGE_MANAGER install
57+
run: $node_pm install
5658

5759
- name: Build
5860
shell: "bash"
5961
env:
6062
PACKAGE_MANAGER: ${{ steps.lockfile.outputs.PACKAGE_MANAGER }}
61-
run: $PACKAGE_MANAGER run build
63+
run: $node_pm run build
6264

6365
- name: Upload Pages Artifact
6466
uses: actions/upload-pages-artifact@v1

0 commit comments

Comments
 (0)