Add workingDirectory option for publishing a subdirectory

This commit is contained in:
Frank Shotwell 2019-11-07 13:15:49 -08:00
parent 05e5e7ad0d
commit bc0254d9f8
3 changed files with 24 additions and 0 deletions

View file

@ -57,6 +57,19 @@ jobs:
environment: 'production' environment: 'production'
``` ```
Optionally, you can also pass a `workingDirectory` key to the action. This will allow you to specify a subdirectory of the repo to run the Wrangler command from.
```yaml
jobs:
deploy:
# ... previous configuration ...
steps:
uses: cloudflare/wrangler-action@1.0.0
with:
# ... api key and email ...
workingDirectory: 'subfoldername'
```
## Use cases ## Use cases
### Deploying when commits are merged to master ### Deploying when commits are merged to master

View file

@ -15,3 +15,5 @@ inputs:
required: true required: true
environment: environment:
description: "The environment you'd like to publish your Workers project to - must be defined in wrangler.toml" description: "The environment you'd like to publish your Workers project to - must be defined in wrangler.toml"
workingDirectory:
description: "The relative path which Wrangler commands should be run from"

View file

@ -30,6 +30,11 @@ export CF_API_KEY="$INPUT_APIKEY"
npm i @cloudflare/wrangler -g npm i @cloudflare/wrangler -g
if ! [ -z "$INPUT_WORKINGDIRECTORY" ]
then
cd $INPUT_WORKINGDIRECTORY
fi
if [ -z "$INPUT_ENVIRONMENT" ] if [ -z "$INPUT_ENVIRONMENT" ]
then then
wrangler publish wrangler publish
@ -37,3 +42,7 @@ else
wrangler publish -e "$INPUT_ENVIRONMENT" wrangler publish -e "$INPUT_ENVIRONMENT"
fi fi
if ! [ -z "$INPUT_WORKINGDIRECTORY" ]
then
cd $HOME
fi