You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+45-26Lines changed: 45 additions & 26 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,52 +21,75 @@ jobs:
21
21
steps:
22
22
- uses: actions/checkout@master
23
23
- name: Publish
24
-
uses: cloudflare/wrangler-action@1.0.0
24
+
uses: cloudflare/wrangler-action@1.1.0
25
25
with:
26
-
apiKey: ${{ secrets.CF_API_KEY }}
27
-
email: ${{ secrets.CF_EMAIL }}
26
+
apiToken: ${{ secrets.CF_API_TOKEN }}
28
27
```
29
28
30
-
## Configuration
29
+
## Authentication
30
+
31
+
You'll need to configure Wrangler using GitHub's Secrets feature - go to "Settings -> Secrets" and add your Cloudflare API token (for help finding this, see the [Workers documentation](https://developers.cloudflare.com/workers/quickstart/#api-token)). Your API token is encrypted by GitHub, and the action won't print it into logs, so it should be safe!
32
+
33
+
With your API token set as a secret for your repository, pass it to the action in the `with` block of your workflow. Below, I've set the secret name to `CF_API_TOKEN`:
31
34
32
-
You'll need to configure Wrangler using GitHub's Secrets feature - go to "Settings -> Secrets" and add your Cloudflare API key and email (for help finding these, see the [Workers documentation](https://developers.cloudflare.com/workers/quickstart/#finding-your-cloudflare-api-keys)). Your API key and email are encrypted by GitHub, and the action won't print them into logs, so they should be safe!
With your API key and email set as secrets for your repository, pass them to the action in the `with` block of your workflow. Below, I've set the secret names to `CF_API_KEY` and `CF_EMAIL`:
45
+
`wrangler-action`also supports using your [global API key and email](https://developers.cloudflare.com/workers/quickstart/#global-api-key) as an authentication method, although API tokens are preferred. Pass in `apiKey` and `email` to the GitHub Action to use this method:
35
46
36
47
```yaml
37
48
jobs:
38
49
deploy:
39
50
name: Deploy
40
51
steps:
41
-
uses: cloudflare/wrangler-action@1.0.0
52
+
uses: cloudflare/wrangler-action@1.1.0
42
53
with:
43
54
apiKey: ${{ secrets.CF_API_KEY }}
44
55
email: ${{ secrets.CF_EMAIL }}
45
56
```
46
57
47
-
Optionally, you can also pass an `environment` key to the action. If you're using Wrangler's [environments](https://github.com/cloudflare/wrangler/blob/master/docs/content/environments.md) feature, you can customize _where_ the action deploys to by passing the matching environment in the `with` block of your workflow:
58
+
## Configuration
59
+
60
+
If you're using Wrangler's [environments](https://github.com/cloudflare/wrangler/blob/master/docs/content/environments.md) feature, you can customize _where_ the action deploys to by passing an `environment` in the `with` block of your workflow:
48
61
49
62
```yaml
50
63
jobs:
51
64
deploy:
52
-
# ... previous configuration ...
53
65
steps:
54
-
uses: cloudflare/wrangler-action@1.0.0
66
+
uses: cloudflare/wrangler-action@1.1.0
55
67
with:
56
-
# ... api key and email ...
68
+
apiToken: ${{ secrets.CF_API_TOKEN }}
57
69
environment: 'production'
58
70
```
59
71
72
+
If you need to install a specific version of Wrangler to use for deployment, you can also pass the input `wranglerVersion` to install a specific version of Wrangler from NPM. This should be a [SemVer](https://semver.org/)-style version number, such as `1.6.0`:
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.
61
85
62
86
```yaml
63
87
jobs:
64
88
deploy:
65
-
# ... previous configuration ...
66
89
steps:
67
-
uses: cloudflare/wrangler-action@1.0.0
90
+
uses: cloudflare/wrangler-action@1.1.0
68
91
with:
69
-
# ... api key and email ...
92
+
apiToken: ${{ secrets.CF_API_TOKEN }}
70
93
workingDirectory: 'subfoldername'
71
94
```
72
95
@@ -89,10 +112,9 @@ jobs:
89
112
steps:
90
113
- uses: actions/checkout@master
91
114
- name: Publish
92
-
uses: cloudflare/wrangler-action@1.0.0
115
+
uses: cloudflare/wrangler-action@1.1.0
93
116
with:
94
-
apiKey: ${{ secrets.CF_API_KEY }}
95
-
email: ${{ secrets.CF_EMAIL }}
117
+
apiToken: ${{ secrets.CF_API_TOKEN }}
96
118
```
97
119
98
120
Note that there are a number of possible events, like `push`, that can be used to trigger a workflow. For more details on the events available, check out the [GitHub Actions documentation](https://help.github.com/en/articles/workflow-syntax-for-github-actions#on).
@@ -113,10 +135,9 @@ jobs:
113
135
steps:
114
136
- uses: actions/checkout@master
115
137
- name: Publish app
116
-
uses: cloudflare/wrangler-action@1.0.0
138
+
uses: cloudflare/wrangler-action@1.1.0
117
139
with:
118
-
apiKey: ${{ secrets.CF_API_KEY }}
119
-
email: ${{ secrets.CF_EMAIL }}
140
+
apiToken: ${{ secrets.CF_API_TOKEN }}
120
141
```
121
142
122
143
If you need help defining the correct cron syntax, check out [crontab.guru](https://crontab.guru/), which provides a friendly user interface for validating your cron schedule.
@@ -136,10 +157,9 @@ jobs:
136
157
steps:
137
158
- uses: actions/checkout@master
138
159
- name: Publish app
139
-
uses: cloudflare/wrangler-action@1.0.0
160
+
uses: cloudflare/wrangler-action@1.1.0
140
161
with:
141
-
apiKey: ${{ secrets.CF_API_KEY }}
142
-
email: ${{ secrets.CF_EMAIL }}
162
+
apiToken: ${{ secrets.CF_API_TOKEN }}
143
163
```
144
164
145
165
To make the GitHub API request, you can deploy a custom [Cloudflare Workers](https://workers.cloudflare.com) function, which will send a `POST` request to GitHub's API and trigger a new deploy:
0 commit comments