Skip to content

Commit

Permalink
Merge pull request #7 from replicatedhq/workingdir
Browse files Browse the repository at this point in the history
Add workingDirectory option for publishing a subdirectory
  • Loading branch information
kristianfreeman authored Nov 22, 2019
2 parents 05e5e7a + bc0254d commit 2360296
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ jobs:
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

### Deploying when commits are merged to master
Expand Down
2 changes: 2 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ inputs:
required: true
environment:
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"
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,19 @@ export CF_API_KEY="$INPUT_APIKEY"

npm i @cloudflare/wrangler -g

if ! [ -z "$INPUT_WORKINGDIRECTORY" ]
then
cd $INPUT_WORKINGDIRECTORY
fi

if [ -z "$INPUT_ENVIRONMENT" ]
then
wrangler publish
else
wrangler publish -e "$INPUT_ENVIRONMENT"
fi

if ! [ -z "$INPUT_WORKINGDIRECTORY" ]
then
cd $HOME
fi

0 comments on commit 2360296

Please sign in to comment.