Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

[Feature request] Allow attaching files #23

Closed
dtitov opened this issue Nov 19, 2019 · 6 comments
Closed

[Feature request] Allow attaching files #23

dtitov opened this issue Nov 19, 2019 · 6 comments

Comments

@dtitov
Copy link

dtitov commented Nov 19, 2019

When one is creating a release manually via GitHub Web interface, it is possible to attach an arbitrary file to a release. I personally use it for attaching jar file to a release.

Is it possible to add this feature to this action? I think it would be very useful.

@eine
Copy link

eine commented Nov 19, 2019

Possible dup of #6.

@IAmHughes
Copy link
Contributor

@1138-4eb thanks for the quick triage. This is something handled by another Action, such as upload-release-asset.

I am more in favor of very small, chainable actions, versus the larger monolithic approach (a release action that can do all things releases versus bite-sized ones).

@dtitov
Copy link
Author

dtitov commented Nov 19, 2019

But it's only one feature that is left out of the scope of this action :) You can't do much more with GitHub releases (at least to my knowledge).

@IAmHughes
Copy link
Contributor

@dtitov understood, but because release assets may have many different requirements for uploads, we prefer adding a step for uploading the asset. Additionally, there may be more things added to the Releases API over time and we would prefer additional chainable actions versus making this one try to be more complex.

Thank you for the suggestion though, I really appreciate it!

@eine
Copy link

eine commented Nov 19, 2019

I understand GitHub's (and @IAmHughes') suggested solution, since steps in the workflow are first class citizens, while groups inside the actions are not. Steps are timed, collapsible by default, etc. I'd say that I even saw steps shown in the sidebar some days ago, but I cannot find where...

Nevertheless, IMHO suggesting heavy use of multiple actions might be sensible for multiple use cases, but it is not for releases and assets. My point is that YAML is not a programming language. Suggesting to integrate multiple pieces of software without a programming language is prone to break (if, being optimistic, it ever works at all). Hence, users will be forced to use multiple actions, plus the YAML file, plus some custom logic in either JS, shell, powershell, etc.

Currently, this repository is a wrapper around a single API call:

const createReleaseResponse = await github.repos.createRelease({
owner,
repo,
tag_name: tag,
name: releaseName,
body,
draft,
prerelease
});

If other actions, such as uploading an asset, are also wrappers around a single API call, users need to take care of bringing all the common params/metadata. Alternatively, developers of all actions need to ensure that all of them fit together automatically, in any order. I don't feel that ensuring so is any easier than maintaining a larger monolithic approach. This is just the classic discussion between monolithic vs distributed repos.

I believe that the main issue now is that there is no official solution provided by GitHub which is even close to the features available in other CI platforms with regard to uploading Assets and Releases. There is neither a monolithic solution nor a set of actions that can be combined programmatically. Without proper docs/READMEs, all these prototypes or proofs of concepts can be misleading for users migrating from other services.

@dtitov, the best solution now (as suggested in #6 (comment)) is for you to build your own action, which you can locate in the .github subdir of your repo. Fortunately, https://octokit.github.io/rest.js/ is well documented. Hence, it really allows you to chain multiple API calls with any parameters you want, even if corresponding official actions are not available yet. Not being a JS/TS developer, I find it easier to do so than to configure a complex workflow with multiple actions. You can use this and other similar actions as a reference. See, for example: https://github.com/1138-4EB/tip/blob/30a16ab7796cfcf5bead940204938c0dbb9879a7/ts/main.ts#L25-L44.

Each of us creating our own actions due to the lack of a proper official solution leads to fragmentation and noise in the marketplace. On the one hand, this might be desired by GitHub for marketing purposes. On the other hand, there is room for sharing resources as JS libs to be used in actions, not as actions themselves. For example, https://github.com/1138-4EB/tip/blob/master/ts/main.ts#L48-L82 might be split and upstreamed elsewhere, in order to be used in actions/upload-artifact#7, upload-release-asset, etc. That's the snippet that allows action params such as:

  files: |
    dist/*
    artifact.txt
    README.md

Writing your own action will require you to either bundle it or distribute node_modules in your repo, which you might not want to do. Alternatively, you might use https://hub.github.com/. According to https://hub.github.com/hub-release.1.html, you can just:

hub release create [-dpoc] [-a <FILE>] [-m <MESSAGE>|-F <FILE>] [-t <TARGET>] <TAG>

@dtitov
Copy link
Author

dtitov commented Nov 19, 2019

Thanks for the detailed answer, I've got the point. I ended up using https://github.com/actions/upload-release-asset, as was suggested by @IAmHughes - it works fine. I just needed some quick solution and didn't really want to invest much time in reinventing the wheel.

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

No branches or pull requests

3 participants