mirror of
https://github.com/cloudflare/wrangler-action.git
synced 2024-11-22 01:53:24 +01:00
add ability to skip publish
This commit is contained in:
parent
93b9408aec
commit
176cda2c0e
4 changed files with 53 additions and 13 deletions
23
.github/workflows/deploy.yml
vendored
23
.github/workflows/deploy.yml
vendored
|
@ -10,6 +10,28 @@ jobs:
|
||||||
uses: azohra/shell-linter@v0.3.0
|
uses: azohra/shell-linter@v0.3.0
|
||||||
with:
|
with:
|
||||||
path: "entrypoint.sh"
|
path: "entrypoint.sh"
|
||||||
|
build-only:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Only build the app
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Build app
|
||||||
|
uses: ./
|
||||||
|
with:
|
||||||
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
workingDirectory: "test"
|
||||||
|
publish: false
|
||||||
|
secrets: |
|
||||||
|
SECRET1
|
||||||
|
SECRET2
|
||||||
|
preCommands: echo "*** pre commands ***"
|
||||||
|
postCommands: |
|
||||||
|
echo "*** post commands ***"
|
||||||
|
wrangler build
|
||||||
|
echo "******"
|
||||||
|
env:
|
||||||
|
SECRET1: ${{ secrets.SECRET1 }}
|
||||||
|
SECRET2: ${{ secrets.SECRET2 }}
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Publish app
|
name: Publish app
|
||||||
|
@ -63,7 +85,6 @@ jobs:
|
||||||
preCommands: echo "*** pre command ***"
|
preCommands: echo "*** pre command ***"
|
||||||
postCommands: |
|
postCommands: |
|
||||||
echo "*** post commands ***"
|
echo "*** post commands ***"
|
||||||
wrangler build
|
|
||||||
echo "******"
|
echo "******"
|
||||||
env:
|
env:
|
||||||
SECRET1: ${{ secrets.SECRET1 }}
|
SECRET1: ${{ secrets.SECRET1 }}
|
||||||
|
|
12
README.md
12
README.md
|
@ -126,6 +126,18 @@ jobs:
|
||||||
echo "******"
|
echo "******"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Set the optional `publish` input to false to skip publishing your Worker project and secrets.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
steps:
|
||||||
|
uses: cloudflare/wrangler-action@1.2.0
|
||||||
|
with:
|
||||||
|
apiToken: ${{ secrets.CF_API_TOKEN }}
|
||||||
|
publish: false
|
||||||
|
```
|
||||||
|
|
||||||
## Use cases
|
## Use cases
|
||||||
|
|
||||||
### Deploying when commits are merged to master
|
### Deploying when commits are merged to master
|
||||||
|
|
|
@ -28,3 +28,6 @@ inputs:
|
||||||
postCommands:
|
postCommands:
|
||||||
description: "Commands to execute after publishing the Workers project"
|
description: "Commands to execute after publishing the Workers project"
|
||||||
required: false
|
required: false
|
||||||
|
publish:
|
||||||
|
description: "Set to false to skip publishing your Worker project and secrets. Defaults to true."
|
||||||
|
required: false
|
|
@ -87,6 +87,9 @@ fi
|
||||||
|
|
||||||
# If an environment is detected as input, for each secret specified get the value of
|
# If an environment is detected as input, for each secret specified get the value of
|
||||||
# the matching named environment variable then configure using wrangler secret put.
|
# the matching named environment variable then configure using wrangler secret put.
|
||||||
|
# Skip if publish is set to false.
|
||||||
|
if [ "$INPUT_PUBLISH" != "false" ]
|
||||||
|
then
|
||||||
if [ -z "$INPUT_ENVIRONMENT" ]
|
if [ -z "$INPUT_ENVIRONMENT" ]
|
||||||
then
|
then
|
||||||
wrangler publish
|
wrangler publish
|
||||||
|
@ -103,6 +106,7 @@ else
|
||||||
echo "$VALUE" | wrangler secret put "$SECRET" --env "$INPUT_ENVIRONMENT"
|
echo "$VALUE" | wrangler secret put "$SECRET" --env "$INPUT_ENVIRONMENT"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# If postcommands is detected as input
|
# If postcommands is detected as input
|
||||||
if [ -n "$INPUT_POSTCOMMANDS" ]
|
if [ -n "$INPUT_POSTCOMMANDS" ]
|
||||||
|
|
Loading…
Reference in a new issue