-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✏️ progress: Factor out meteor-actions/setup-node.
- Loading branch information
1 parent
539128f
commit 6873dbb
Showing
2 changed files
with
55 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: "meteor-actions/setup-node" | ||
description: "Set up Meteor's Node.js" | ||
inputs: | ||
node-version: | ||
description: 'The Node.js version to use' | ||
required: true | ||
nvm-version: | ||
description: 'The version of nvm to use in case actions/setup-node fails' | ||
default: 'v0.39.7' | ||
required: true | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/setup-node@v4 | ||
id: setup-node | ||
with: | ||
node-version: ${{ inputs.node-version }} | ||
continue-on-error: true | ||
|
||
- name: Install nvm | ||
if: ${{ steps.setup-node.outcome != 'success' }} | ||
shell: bash | ||
run: | | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/${{ inputs.nvm-version }}/install.sh | bash | ||
export NVM_DIR="${HOME}/.nvm" | ||
echo "NVM_DIR=${NVM_DIR}" >> "$GITHUB_ENV" | ||
- name: Install Meteor-specific Node version via nvm | ||
if: ${{ steps.setup-node.outcome != 'success' }} | ||
env: | ||
ARCH: ${{ matrix.architecture }} | ||
NODE_VERSION: ${{ inputs.node-version }} | ||
NVM_DIR: ${{ env.NVM_DIR }} | ||
shell: bash | ||
run: | | ||
export NODE_INSTALL_PATH="${NVM_DIR}/versions/node/v${NODE_VERSION}" | ||
curl "https://static.meteor.com/dev-bundle-node-os/v${NODE_VERSION}/node-v${NODE_VERSION}-${ARCH}.tar.gz" | tar xzf - -C /tmp/ | ||
mkdir -p "${NODE_INSTALL_PATH}" | ||
rm -r "${NODE_INSTALL_PATH}" | ||
mv "/tmp/node-v${NODE_VERSION}-${ARCH}" "${NODE_INSTALL_PATH}" | ||
- name: Use Meteor-specific Node version via nvm | ||
if: ${{ steps.setup-node.outcome != 'success' }} | ||
env: | ||
NODE_VERSION: ${{ inputs.node-version }} | ||
NVM_DIR: ${{ env.NVM_DIR }} | ||
shell: bash | ||
run: | | ||
source "${NVM_DIR}/nvm.sh" | ||
nvm use "${NODE_VERSION}" | ||
export NODE_PATH="$(dirname $(nvm which $(node --version)))" | ||
echo "${NODE_PATH}" >> "$GITHUB_PATH" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters