Skip to content

Commit

Permalink
Add an optional base directory
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertoPdRF committed Aug 12, 2020
1 parent e654201 commit 176e087
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ your workflow file.

The inputs this action uses are:

| Name | Required | Default | Description |
|:----:|:--------:|:-------:|:-----------:|
| `NETLIFY_AUTH_TOKEN` | `true` | N/A | The token needed to deploy your site ([generate here](https://app.netlify.com/user/applications#personal-access-tokens))|
| `NETLIFY_SITE_ID` | `true` | N/A | The site to where deploy your site (get it from the API ID on your Site Settings) |
| `NETLIFY_DEPLOY_MESSAGE` | `false` | '' | An optional deploy message |
| `build_directory` | `false` | `'build'` | The directory where your files are built |
| `functions_directory` | `false` | N/A | The (optional) directory where your Netlify functions are stored |
| `install_command` | `false` | `npm i` | The (optional) command to install dependencies |
| `build_command` | `false` | `npm run build` | The (optional) command to build static website |
| Name | Required | Default | Description |
| :----------------------: | :------: | :-------------: | :----------------------------------------------------------------------------------------------------------------------: |
| `NETLIFY_AUTH_TOKEN` | `true` | N/A | The token needed to deploy your site ([generate here](https://app.netlify.com/user/applications#personal-access-tokens)) |
| `NETLIFY_SITE_ID` | `true` | N/A | The site to where deploy your site (get it from the API ID on your Site Settings) |
| `NETLIFY_DEPLOY_MESSAGE` | `false` | '' | An optional deploy message |
| `build_directory` | `false` | `'build'` | The directory where your files are built |
| `functions_directory` | `false` | N/A | The (optional) directory where your Netlify functions are stored |
| `install_command` | `false` | `npm i` | The (optional) command to install dependencies |
| `build_command` | `false` | `npm run build` | The (optional) command to build static website |
| `base_directory` | `false` | '' | The directory where the commands will be executed |

## Example

Expand All @@ -65,7 +66,7 @@ jobs:
with:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_DEPLOY_MESSAGE: "Prod deploy v${{ github.ref }}"
NETLIFY_DEPLOY_MESSAGE: 'Prod deploy v${{ github.ref }}'
NETLIFY_DEPLOY_TO_PROD: true
```

Expand All @@ -89,5 +90,4 @@ jobs:
with:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

```
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ inputs:
required: false
default: 'npm run build'

base_directory:
description: 'The directory where the commands will be executed'
required: false
default: 'build'

runs:
using: 'docker'
image: 'Dockerfile'
Expand All @@ -54,6 +59,7 @@ runs:
- ${{ inputs.functions_directory }}
- ${{ inputs.install_command }}
- ${{ inputs.build_command }}
- ${{ inputs.base_directory }}

branding:
icon: activity
Expand Down
6 changes: 6 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ BUILD_DIRECTORY=$4
FUNCTIONS_DIRECTORY=$5
INSTALL_COMMAND=$6
BUILD_COMMAND=$7
BASE_DIRECTORY=$8

if [[ $BASE_DIRECTORY ]]
then
cd $BASE_DIRECTORY
fi

# Install dependencies
eval ${INSTALL_COMMAND:-"npm i"}
Expand Down

0 comments on commit 176e087

Please sign in to comment.