Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for S3 provider instead of github #41

Open
dede-plato opened this issue Jun 26, 2018 · 2 comments
Open

Example for S3 provider instead of github #41

dede-plato opened this issue Jun 26, 2018 · 2 comments

Comments

@dede-plato
Copy link

Hi,
I am looking for the example of s3 provider for auto-update.
I've already done s3 publishing. But can't check the update from s3.
Is there any example that I can follow for the window? Thanks.

@iffy
Copy link
Owner

iffy commented Jun 26, 2018

@dede-plato I have no experience with S3 (and very little with Windows). But to whoever knows how to do it, feel free to post here.

@kittaakos
Copy link

kittaakos commented May 20, 2020

I did it for macOS, but I would assume, it is the same for Windows.

With the electron-builder one has the use the S3Options. (Here is the JSON scheme for S3 if you prefer that.)

{
...  
"build": {
    ...
    "publish": [
      {
        "provider": "s3",
        "bucket": "your-bucket-name",
        "path": "optional/download/path"
      }
    ],
    ...
  },
...
}

Assuming your S3 is public, you can omit the acl prop, it falls back to "public-read". If your bucket is private, see this or this threads.

You also have to tune the ACL config on S3, I ended up with this policy file based on this and this comments.

{
  "Statement": [
    {
      "Sid": "yourId1",
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket",
        "s3:GetBucketLocation",
        "s3:ListBucketMultipartUploads"
      ],
      "Resource": "arn:aws:s3:::your-bucket-name"
    },
    {
      "Sid": "yourId2",
      "Effect": "Allow",
      "Action": [
        "s3:AbortMultipartUpload",
        "s3:GetObject",
        "s3:GetObjectAcl",
        "s3:GetObjectVersion",
        "s3:ListMultipartUploadParts",
        "s3:PutObject",
        "s3:PutObjectAcl"
      ],
      "Resource": "arn:aws:s3:::your-bucket-name/optional/download/path/*"
    }
  ],
  "Version": "2012-10-17"
}

Notes:

  • You can explicitly set the acl prop to null,
  • People say it is better to use a secret env variable for the bucket name, instead of writing it into the electron builder config (YAML, or package.json). I could not achieve it.

I hope this helps others configuring the electron updated with S3.

PS: If you have spotted any mistakes/anti-patterns in my config, let me know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants