Reputation: 483
I have a completed open-source project on GitLab. It compiles a .iso file, which is the only relevant file for the end user.
Now, is it possible to create a Release that will only contain the .iso file? This would allow anyone to conveniently download the current release file, while also being able to have a look a the source code if they want.
Right now I'm only seeing options to tag my entire master branch as a "release".
Best
Upvotes: 3
Views: 5325
Reputation: 1714
I was just looking for this. Reading some documentation, Gitlab, Github etc even from git-scm.com just got me more confused.
So, following from here, https://justanopinion.blog/gitattributes-in-github-releases/, I got it almost working. I created a .gitattributes file on the root of my project; Inside the file I added what I DO NOT want to be inside the compressed files (tar.gz2, tar.gz, zip etc). An example:
# .gitattributes
dev/ export-ignore
.gitignore export-ignore
.gitattributes export-ignore
And to test, as showed on the article, I ran from the root of the project:
git archive --format=tar.gz HEAD -o /tmp/TEST-RELEASE.tar.gz
BUT if you do that it won't work, because you have to commit the changes first.
git add .gitattributes
git commit -m "Added .gitattributes file."
git archive --format=tar.gz HEAD -o /tmp/TEST-RELEASE.tar.gz
You can check after by uncompressing it
cd /tmp
tar xvf TEST-RELEASE.tar.gz
Upvotes: 1
Reputation: 828
I have the same problem. I'd like for "releases" to only contain a single download - the release artifact, not all the source code too.
My releases come from version tagging in git and match up 1:1, so I really don't need the source "also released" under the tag.
Bottom line, gitlab doesn't have this as a feature.
BUT
I took the answer from this stackoverflow and created a .gitattributes with the following entries, and now at least the "source artifacts" are empty zips/tars.
* export-ignore
.* export-ignore
Upvotes: 2
Reputation: 828
There is currently no way to release only a single artifact, like your .iso, without also releasing all the source.
Upvotes: 1
Reputation: 2705
GitLab releases allow you to add 'asset' links. An asset can be source code or a URL. A URL can point to a binary file. See Releases documentation.
What I think will work for you is to have your build and release process upload the .iso as an artifact. Then you can add an asset link to the release with the URL to download the artifact. Check out the artifact download documentation to see how to build the download URL. The ref
will be the tag.
You will need to use the API to create the asset link. See the Releases API documentation - specifically, how to 'create a link'
Upvotes: 2