Skip to content

Commit 200c318

Browse files
committed
refactor(publish): rely on wrangler auth for cloudflare pages
1 parent 6677f60 commit 200c318

4 files changed

Lines changed: 25 additions & 397 deletions

File tree

‎src/command/publish/account.ts‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,13 @@ export async function resolveAccount(
4949
let token: AccountToken | undefined;
5050

5151
// build list of account options
52-
let accounts = await provider.accountTokens();
53-
if (provider.filterAccountsByServer !== false) {
54-
accounts = accounts.filter((account) => {
55-
if (account.server && target?.url) {
56-
return target.url.startsWith(account.server);
57-
} else {
58-
return true;
59-
}
60-
});
61-
}
52+
const accounts = (await provider.accountTokens()).filter((account) => {
53+
if (account.server && target?.url) {
54+
return target.url.startsWith(account.server);
55+
} else {
56+
return true;
57+
}
58+
});
6259

6360
// if we aren't prompting then we need to have one at the ready
6461
if (prompt === "never") {

‎src/publish/README.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ As an alternative to providing account credentials interactively, you case use t
4646
| Service | Variables |
4747
| -------------- | -------------------------------------- |
4848
| Netlify | `NETLIFY_AUTH_TOKEN` |
49-
| Cloudflare Pages | `CLOUDFLARE_ACCOUNT_ID` and `CLOUDFLARE_API_TOKEN` |
5049
| Postit Connect | `CONNECT_SERVER` and `CONNECT_API_KEY` |
5150

5251
Using an environment variable combined with a `_publish.yml` file that points to the requisite publishing destination is enough to enable the following command to perform a headless publish on CI:
@@ -57,7 +56,7 @@ quarto publish
5756

5857
GitHub Pages publishing requires no special environment variables (as it use the version of git available on your system or on the CI server).
5958

60-
Cloudflare Pages publishing uses the Wrangler CLI. Install Wrangler and provide a Cloudflare account ID and API token via environment variables or command line options.
59+
Cloudflare Pages publishing uses the Wrangler CLI. Install Wrangler and authenticate it (for example, run `wrangler login` or set `CLOUDFLARE_API_TOKEN` for CI).
6160

6261
### Command Line
6362

@@ -72,7 +71,6 @@ If your credentials are not stored in an environment variable as described above
7271

7372
```bash
7473
quarto publish netlify --id DDA36416-F950-4647-815C-01A24233E294 --token 7C0947A852D8
75-
quarto publish cloudflare-pages --id my-quarto-site --server 0123456789abcdef --token CF_API_TOKEN
7674
```
7775

7876
When publishing to Posit Connect you should make sure that the server, token, and id are all available either via environment variables or the command line. For example:

0 commit comments

Comments
 (0)