Git: file management in a push event

I have a repository with a LaTeX project that contains a .pdf compiled and generated from a .tex file. I want the history and source files to be private, but the .pdf should be publicly available and have a fixed URL. GitHub itself provides a fixed URL for a single file, but in order to make it public, I need to set up a public repository, and it also provides history and all other files to the public.
Do you think there is a way for GitHub (or BitBucket, or ...) to pull a single .pdf file to another location so that it has a fixed unique and public URL? I thought I could somehow push it to AWS S3 or get Lambda by receiving an HTTP call and am going to extract one file, but it can be a lot easier than I don't know.

+4
source share
3 answers

Ok, this is how I handled it (thanks a lot 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>

Then I set up the repository to serve the branch masterfor the git page. Then I used my own domain and created a CloudFlare subdomain that owns the NameServers of my domain, pointing it to my GitHub page and setting the same subdomain in the repository as my custom domain address.

: , index.html, , , . , , .

+1

Max, . , . :

  • PDF
  • - git PDF
  • Github

post-commit ( ) git .git/hooks. bash, PDF , : cp ~/private-repo/document.pdf ~/public-repo/document.pdf.

+2

GitHub . :

GitHub Pages , .

master CI, , PDF gh-pages. (, username.imtqy.com ), , GitHub master, - release .

I use a similar workflow to create a PDF file from a .tex file using Travis. The source is publicly available, but the workflow will work for a private repository. The only problem is that the public version of Travis cannot work on private repositories, but Travis Pro and other tools like CircleCI can do this.

+2
source

Source: https://habr.com/ru/post/1695113/


All Articles