Version 1.1.0
of wrangler-action
includes support for Wrangler's new API token authentication, as well as a few features requested and developed by community members using wrangler-action
in their production systems.
To upgrade to wrangler-action
1.1.0, update the uses
field in your workflow, passing in the new version of wrangler-action
, cloudflare/[email protected]
:
- name: Deploy to Cloudflare Workers with Wrangler
uses: cloudflare/[email protected]
Features
Authentication via API tokens
As per cloudflare/wrangler-legacy#471, wrangler-action
now supports (and encourages) the use of Cloudflare API tokens. To learn how to generate a new API token, check out our docs!
To use an API token, pass the apiToken
input in your workflow to wrangler-action
:
name: Deploy
on:
push:
branches:
- master
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
steps:
- uses: actions/checkout@master
- name: Publish
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
Note that this change deprecates apiKey
and email
, making them optional parameters. If you use apiKey
and email
in your project, it will continue to work as you'd expect, but you will receive a notice in the logs that API tokens are preferred. Hooray, security!
Use a specific Wrangler version
If you need to use a specific version of Wrangler with your action, you can now pass in wranglerVersion
to your workflow in order to tell NPM to install that specific version.
jobs:
deploy:
steps:
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
wranglerVersion: '1.6.0'
Working directories
Per #7, wrangler-action
now supports a working directory, allowing you to run wrangler-action
in a specific directory in your repo. This can be useful for repositories with a Workers application that isn't the top-level of the repository:
jobs:
deploy:
steps:
uses: cloudflare/[email protected]
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
workingDirectory: 'subfoldername'
Thank you to @fshot for this contribution!
Maintenance
We've included a test
directory which contains a full Workers application. We'll use this to dogfood future versions of wrangler-action
and new features that we develop.
Thank you to the following folks for review and help on this release: @fshot, @adaptive, @EverlastingBugstopper, @minddust, @victoriabernard92