Merge pull request #7 from replicatedhq/workingdir

Add workingDirectory option for publishing a subdirectory
This commit is contained in:
Kristian Freeman 2019-11-22 10:40:19 -06:00 committed by GitHub
commit 2360296525
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 0 deletions

View file

@ -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

View file

@ -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"

View file

@ -30,6 +30,11 @@ 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
@ -37,3 +42,7 @@ else
wrangler publish -e "$INPUT_ENVIRONMENT"
fi
if ! [ -z "$INPUT_WORKINGDIRECTORY" ]
then
cd $HOME
fi