I have a repository with a LaTeX project that includes the .pdf compiled and generated from the .tex file. I want the history and the source files to be private but the .pdf should be public and with a fixed URL. GitHub itself provides a fixed URL for the single file but in order to make it publicly available I need to set the repository public and this exposes also the history and all other files to the public.
Do you think there is a way where I can have GitHub (or BitBucket, or ...) to push the single .pdf file somewhere else so that it has a fixed unique and public URL? I thought I could somehow push it to AWS's S3 or have a Lambda receiving a HTTP call and going to fetch the single file but there could be a far easier way I don't know.
Ok here's how I worked it out (many thanks to @cmbuckley who pointed me in the right direction).
I created a very simple index.html file in the repository with the TeX project:
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
</body>
</html>
<script>
$(document).ready(function() {
var link=document.createElement('a');
link.href = "EXISTING_FILE_NAME";
link.download = "NEW_FILENAME";
link.click();
});
</script>
I then set up the repository to serve the master
branch for the git-page. I then used my own domain and created a subdomain on CloudFlare, that owns the NameServers of my domain, pointing it to my GitHub page, and set the
same subdomain on the repository as my custom domain address.
What happens now is this: a user goes to the custom subdomain, he gets the index.html page that automatically downloads the file in the most recent version as it's the one served. Yet the repository is private and even the name of the file gets changed so nobody sees it.