electron / electron/forge

Requesting a Post Publish Hook

Open
#3,141 0 comments 4 reactions 0 assignees View on GitHub
publisher
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [X] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [X] I have searched the issue tracker for a feature request that matches the one I want to file, without success.

### Problem description

At the moment after publishing there doesn't seem to be a good way to get a list of the artifacts you've uploaded, which might be useful if you want to automate testing them or do some kind of automated deployment.

```js
publishers: [
{
name: "@electron-forge/publisher-s3",
config: {
keyResolver: (filename, platform, arch) => {
const key = calculateKey(
filename,
platform,
determineOutputArch(platform, arch)
);

// do something with the key here.

return key;
},
},
},
],
```

But that requires some fairly messy logic to combine the artifacts and doesn't actually tell you when they've been uploaded.

### Proposed solution

A hook similar to postMake

```ts
postPublish: async (forgeConfig, publishedList) => {

})
```

where publishedList contains at minimum
```ts
type publishedList = {
arch: "x64",
platform: "win32",
target: "msi", // or "@electron-forge/maker-squirrel"
files: [{ key, filename }] // though key is only for s3 from what I understand
}
```

### Alternatives considered

Gathering snapshots of data from within keyResolver
* Logic is complex and error prone

Saving optionsList from postMake and processing it.
* Not the worst solution, does mean pulling filenames out of the paths in the artifacts and re-creating some of what electron-forge does.

### Additional information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.