Victor
Victor

Reputation: 688

Github releases: how to include symlink contents into source code?

We are using Github releases tool for our projects.

Github releases assets

It works quite well. Github automatically generates an archive of the source files. However, we have windows symlinks to other folders in the source files.

We use shared source code between projects for some parts of the program. These are cloned once per computer and each repository that needs it links to these repositories using symlinks.

Is there a way to force github including the symlinks content not as a reference but as a deep copy in the Source code archive?

We want to make sure we can compile the program again and obtain the same binary output in a few years, even if the common code base has evolved in the meantime.

Upvotes: 2

Views: 653

Answers (1)

bk2204
bk2204

Reputation: 76984

No, you cannot do this. GitHub essentially uses git archive under the hood (although that it will continue to is not guaranteed), which does not dereference symlinks in any way.

Even if git archive supported dereferencing symlinks, there'd be no way to know where a symlink that pointed outside of the working tree should go when GitHub archived it. GitHub has no knowledge about how you organize your source code on your computers.

If you want to produce archives that dereference symlinks, you'll need to do something like the following (for GNU tar):

git ls-files | xargs tar -uvhf ../archive.tar

Note the -h option, which dereferences symlinks. You can then compress this archive with gzip or your compressor of choice and upload it as a release asset, either manually or using the API.

Upvotes: 2

Related Questions