Skip to content

Commit

Permalink
Merge pull request #124 from cloudflare/lrapoport/publish-to-deploy
Browse files Browse the repository at this point in the history
Update publish to deploy
  • Loading branch information
lrapoport-cf authored Aug 7, 2023
2 parents 20ea506 + 45c57ae commit e18e1df
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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 }}
Expand All @@ -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]
Expand All @@ -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
Expand All @@ -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 }}
Expand All @@ -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.
Expand All @@ -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 }}
Expand Down
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"`.'
Expand Down

0 comments on commit e18e1df

Please sign in to comment.