mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-25 03:14:46 +01:00
Add workingDirectory option for publishing a subdirectory
This commit is contained in:
parent
05e5e7ad0d
commit
bc0254d9f8
3 changed files with 24 additions and 0 deletions
13
README.md
13
README.md
|
@ -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
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue