Merge pull request #124 from cloudflare/lrapoport/publish-to-deploy

Update publish to deploy
This commit is contained in:
lrapoport-cf 2023-08-07 16:31:50 -04:00 committed by GitHub
commit e18e1dfc82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 15 deletions

View file

@ -9,7 +9,7 @@ Easy-to-use GitHub Action to use [Wrangler](https://developers.cloudflare.com/wo
## Usage
Add `wrangler-action` to the workflow for your Workers/Pages application. The below example will publish a Worker on a `git push` to the `main` branch:
Add `wrangler-action` to the workflow for your Workers/Pages application. The below example will deploy a Worker on a `git push` to the `main` branch:
```yaml
name: Deploy
@ -25,7 +25,7 @@ jobs:
name: Deploy
steps:
- uses: actions/checkout@v2
- name: Publish
- name: Deploy
uses: cloudflare/wrangler-action@3.0.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
@ -90,7 +90,7 @@ jobs:
SECRET2: ${{ secrets.SECRET2 }}
```
If you need to run additional shell commands before or after your command, you can specify them as input to `preCommands` (before `publish`) or `postCommands` (after `publish`). These can include additional `wrangler` commands (that is, `whoami`, `kv:key put`) or any other commands available inside the `wrangler-action` context.
If you need to run additional shell commands before or after your command, you can specify them as input to `preCommands` (before `deploy`) or `postCommands` (after `deploy`). These can include additional `wrangler` commands (that is, `whoami`, `kv:key put`) or any other commands available inside the `wrangler-action` context.
```yaml
jobs:
@ -136,7 +136,7 @@ jobs:
name: Deploy
steps:
- uses: actions/checkout@v3
- name: Publish
- name: Deploy
uses: cloudflare/wrangler-action@3.0.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
@ -146,7 +146,7 @@ Note that there are a number of possible events, like `push`, that can be used t
### Deploy your Pages site (production & preview)
If you want to deploy your Pages project with GitHub Actions rather than the built-in continous integration (CI), then this is a great way to do it. Wrangler 2 will populate the commit message and branch for you. You only need to pass the project name. If a push to a non-production branch is done, it will publish as a preview deployment:
If you want to deploy your Pages project with GitHub Actions rather than the built-in continous integration (CI), then this is a great way to do it. Wrangler 2 will populate the commit message and branch for you. You only need to pass the project name. If a push to a non-production branch is done, it will deploy as a preview deployment:
```yaml
on: [push]
@ -157,12 +157,12 @@ jobs:
name: Deploy
steps:
- uses: actions/checkout@v3
- name: Publish
- name: Deploy
uses: cloudflare/wrangler-action@3.0.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: pages publish --project-name=example
command: pages deploy --project-name=example
```
### Deploying on a schedule
@ -180,7 +180,7 @@ jobs:
name: Deploy
steps:
- uses: actions/checkout@v3
- name: Publish app
- name: Deploy app
uses: cloudflare/wrangler-action@3.0.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
@ -206,11 +206,11 @@ jobs:
name: Deploy
steps:
- uses: actions/checkout@v3
- name: Publish app
- name: Deploy app
uses: cloudflare/wrangler-action@3.0.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
command: publish --env ${{ github.event.inputs.environment }}
command: deploy --env ${{ github.event.inputs.environment }}
```
For more advanced usage or to programmatically trigger the workflow from scripts, refer to [the GitHub documentation](https://docs.github.com/en/rest/reference/actions#create-a-workflow-dispatch-event) for making API calls.
@ -234,7 +234,7 @@ jobs:
name: Deploy
steps:
- uses: actions/checkout@v3
- name: Publish app
- name: Deploy app
uses: cloudflare/wrangler-action@3.0.0
with:
apiToken: ${{ secrets.CF_API_TOKEN }}

View file

@ -15,21 +15,21 @@ inputs:
required: false
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 deploy your Workers project to - must be defined in wrangler.toml"
workingDirectory:
description: "The relative path which Wrangler commands should be run from"
required: false
wranglerVersion:
description: "The version of Wrangler you'd like to use to publish your Workers project"
description: "The version of Wrangler you'd like to use to deploy your Workers project"
required: false
secrets:
description: "A string of environment variable names, separated by newlines. These will be bound to your Worker as Secrets and must match the names of environment variables declared in `env` of this workflow."
required: false
preCommands:
description: "Commands to execute before publishing the Workers project"
description: "Commands to execute before deploying the Workers project"
required: false
postCommands:
description: "Commands to execute after publishing the Workers project"
description: "Commands to execute after deploying the Workers project"
required: false
command:
description: 'The Wrangler command (along with any arguments) you wish to run. Multiple Wrangler commands can be run by separating each command with a newline. Defaults to `"deploy"`.'