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

Install node using nvm #23

Merged
merged 4 commits into from Nov 10, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
@@ -1,4 +1,4 @@
FROM node:current-stretch-slim
FROM node:current-stretch
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Less slim image which comes with curl


ADD entrypoint.sh /entrypoint.sh
ADD action.yml /action.yml
Expand Down
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -134,3 +134,9 @@ jobs:
state: success
target_url: https://${{ env.BRANCH_NAME }}--my-site.netlify.app
```

### Selecting node version

By default, the latest node will be installed before buidling the application.

To select a different release, create an `.nvmrc` file with the desired version range.
tpluscode marked this conversation as resolved.
Show resolved Hide resolved
12 changes: 11 additions & 1 deletion entrypoint.sh
@@ -1,7 +1,17 @@
#!/bin/bash

# Install netlify globally before NVM to prevent EACCESS issues
npm i -g netlify-cli

# Save its exec path to run later
NETLIFY_CLI=$(which netlify)

# Install node from NVM to honor .nvmrc files
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.2/install.sh | bash
[ -s "$HOME/.nvm/nvm.sh" ] && \. "$HOME/.nvm/nvm.sh"

nvm install
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I install netlify-cli first, because once nvm installs into $HOME it is no longer possible to install globally.

Better ideas welcome


NETLIFY_AUTH_TOKEN=$1
NETLIFY_SITE_ID=$2
NETLIFY_DEPLOY_TO_PROD=$3
Expand Down Expand Up @@ -29,7 +39,7 @@ eval ${BUILD_COMMAND:-"npm run build"}
export NETLIFY_SITE_ID=$NETLIFY_SITE_ID
export NETLIFY_AUTH_TOKEN=$NETLIFY_AUTH_TOKEN

COMMAND="netlify deploy --dir=$BUILD_DIRECTORY --functions=$FUNCTIONS_DIRECTORY --message=\"$INPUT_NETLIFY_DEPLOY_MESSAGE\""
COMMAND="$NETLIFY_CLI deploy --dir=$BUILD_DIRECTORY --functions=$FUNCTIONS_DIRECTORY --message=\"$INPUT_NETLIFY_DEPLOY_MESSAGE\""

if [[ $NETLIFY_DEPLOY_TO_PROD == "true" ]]
then
Expand Down