How to use Github Release API to make a release without source code?

Viewed 10182

I am using blow command to publish a release on Github repo:

curl -X POST -H "Authorization: token xxxxxxxxx"  -d '{"tag_name": "test", "name":"release-0.0.1","body":"this is a test release"}'  https://api.github.com/repos/xxxxxx

I can see that a new release is created. But there are two download buttons under it:

Source code (zip)
Source code (tar.gz)

How can I make a release without source code?

If I can't remove the source code attachment, how can I upload additional binary files? I tried to use the API Upload a release asset like this: POST https://<upload_url>/repos/:owner/:repo/releases/:id/assets?name=foo.zip, it returns successfully but I couldn't find the binaries on Github release tab.

3 Answers

You can control the contents of sorcecode archive within automatic generation using the .gitattributes file (and make it part of your repository).

Add lines like:

src export-ignore

to exclude the directory "src" from being part of the generated source package. Internally github uses "git archive" to create packages based on the tags - and "git archive" can be controlled via ".gitattributes".

Don't know whether you can avoid generating the source package completely - but this is at least a workaround to control the contents of the source code package

Related