Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
73a99dd
feat: add PublisherR2Config interface for Cloudflare R2 configuration
matos-ed Jan 8, 2026
c33b88b
feat: implement PublisherR2 class for Cloudflare R2 publishing
matos-ed Jan 8, 2026
a45d874
feat: add README for publisher-r2 with configuration and usage details
matos-ed Jan 8, 2026
cb66acb
feat: add package.json for Cloudflare R2 publisher
matos-ed Jan 8, 2026
7e92354
fix: update README to reflect correct R2 API credentials and configur…
matos-ed Jan 8, 2026
303d452
fix: clean up and add aws deps at package.json for Cloudflare R2 publ…
matos-ed Jan 8, 2026
f5ef7fc
fix: update PublisherR2 tests to use accessKeyId and secretAccessKey …
matos-ed Jan 8, 2026
4632412
fix: update PublisherR2Config to replace apiToken with accessKeyId an…
matos-ed Jan 8, 2026
544b39d
fix: refactor PublisherR2 to use S3Client for uploads and replace api…
matos-ed Jan 8, 2026
08ab035
fix: remove PublisherR2 implementation and related files
matos-ed Jan 9, 2026
a2bcb06
fix: update description and add mime-types dependency in package.json
matos-ed Jan 9, 2026
c943712
fix: update PublisherS3Config to include provider and accountId field…
matos-ed Jan 9, 2026
c1d800f
fix: enhance PublisherS3 to support R2 validation and content type ha…
matos-ed Jan 9, 2026
b9d51f7
fix: update README to include Cloudflare R2 support and enhance AWS S…
matos-ed Jan 9, 2026
3742fd3
test: add R2 provider tests for PublisherS3 with validation and publi…
matos-ed Jan 9, 2026
fcf89ea
Merge remote-tracking branch 'upstream/main'
matos-ed Jan 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions packages/publisher/r2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
## publisher-r2

`@electron-forge/publisher-r2` publishes all your artifacts to a Cloudflare R2 bucket where users will be able to download them.

By default, all files are positioned at the following key:

${config.folder || appVersion}/${platform}/${arch}/${artifactName}

Configuration options are documented in [PublisherR2Config](https://js.electronforge.io/interfaces/_electron_forge_publisher_r2.PublisherR2Config.html).

```javascript title=forge.config.js
module.exports = {
// ...
publishers: [
{
name: '@electron-forge/publisher-r2',
config: {
bucket: 'my-bucket',
accountId: 'your-cloudflare-account-id',
apiToken: 'your-cloudflare-api-token'
}
}
]
};
```

If you run publish twice with the same version on the same platform, it is possible for your old artifacts to get overwritten in R2. It is your responsibility to ensure that you don't overwrite your own releases.

### Authentication

This publisher uses the wrangler npm package to interact with Cloudflare R2. You need to provide your Cloudflare API credentials in the configuration:

```javascript
config: {
accountId: 'your-cloudflare-account-id',
apiToken: 'your-cloudflare-api-token',
bucket: 'my-bucket',
// ...
}
```

#### Getting Your Credentials

- **Account ID**: Found in the Cloudflare dashboard URL or on the R2 overview page
- **API Token**: Create a token with R2 read and write permissions from the [Cloudflare API Tokens page](https://dash.cloudflare.com/profile/api-tokens). Make sure the token has "Account.R2 Storage" permissions.

### Public Access

To make your artifacts publicly accessible, configure a custom domain for your R2 bucket in the Cloudflare dashboard. Public access is managed entirely through Cloudflare's R2 bucket settings, not through this publisher.

### Custom Key Resolver

You can provide a custom function to determine the key (path) for each artifact:

```javascript
config: {
bucket: 'my-bucket',
keyResolver: (fileName, platform, arch) => {
return `releases/v1.0.0/${platform}/${fileName}`;
}
}
```
28 changes: 28 additions & 0 deletions packages/publisher/r2/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "@electron-forge/publisher-r2",
"version": "7.10.2",
"description": "Cloudflare R2 publisher for Electron Forge",
"repository": "https://github.com/electron/forge",
"author": "Electron Forge",
"license": "MIT",
"main": "dist/PublisherR2.js",
"typings": "dist/PublisherR2.d.ts",
"engines": {
"node": ">= 16.4.0"
},
"dependencies": {
"@electron-forge/publisher-static": "7.10.2",
"@electron-forge/shared-types": "7.10.2",
"debug": "^4.3.1",
"execa": "^9.0.0",
"mime-types": "^2.1.25",
"wrangler": "^4.54.0"
},
"publishConfig": {
"access": "public"
},
"files": [
"dist",
"src"
]
}
Loading