<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sina D</title>
    <description>The latest articles on DEV Community by Sina D (@ssinad).</description>
    <link>https://dev.to/ssinad</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F364877%2F3e3d7d26-5f28-4ad1-b059-883c5d575642.png</url>
      <title>DEV Community: Sina D</title>
      <link>https://dev.to/ssinad</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ssinad"/>
    <language>en</language>
    <item>
      <title>Compile LaTeX Documents and Upload to Google Drive</title>
      <dc:creator>Sina D</dc:creator>
      <pubDate>Sun, 16 Aug 2020 06:06:03 +0000</pubDate>
      <link>https://dev.to/ssinad/compile-latex-document-and-upload-to-google-drive-97f</link>
      <guid>https://dev.to/ssinad/compile-latex-document-and-upload-to-google-drive-97f</guid>
      <description>&lt;h3&gt;
  
  
  My Workflow
&lt;/h3&gt;

&lt;p&gt;I wrote this workflow to keep a history of a latex document I was working on. I also wanted the document to be synced with my Google drive without me having to manually upload it every time I made a change.&lt;/p&gt;

&lt;h4&gt;
  
  
  Prerequisites
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;A Google &lt;a href="https://cloud.google.com/iam/docs/service-accounts"&gt;service account&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;An encryption tool such as &lt;code&gt;gpg&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Google drive file ID (The file must be shared with the email associated with the service account)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;GitHub suggests using tools such as &lt;code&gt;gpg&lt;/code&gt; to store large secrets. I used &lt;code&gt;gpg&lt;/code&gt; to encrypt the json file for the service account and included the encrypted file in the repository. I saved the passphrase as a GitHub secret.&lt;br&gt;&lt;br&gt;
I also uploaded the first version of my pdf on to Google drive to get a file ID, which I saved as a GitHub secret, as well. I shared this file with the email associated with that service account.&lt;/p&gt;
&lt;h4&gt;
  
  
  Workflow Steps
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Install &lt;code&gt;texlive&lt;/code&gt; (&lt;code&gt;latexmk&lt;/code&gt; included)&lt;/li&gt;
&lt;li&gt;Compile and typeset the pdf document&lt;/li&gt;
&lt;li&gt;Save the generated pdf as an artifact&lt;/li&gt;
&lt;li&gt;Decrypt the encrypted service account JSON file&lt;/li&gt;
&lt;li&gt;Install &lt;a href="https://pypi.org/project/google-api-python-client/"&gt;&lt;code&gt;google-api-python-client&lt;/code&gt;&lt;/a&gt; python library&lt;/li&gt;
&lt;li&gt;Upload the new version of the pdf onto Google Drive&lt;/li&gt;
&lt;/ol&gt;
&lt;h4&gt;
  
  
  Possible Improvements
&lt;/h4&gt;

&lt;p&gt;This was my first experience with GitHub Actions so there is still room for improvement, for example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The steps 1, 4, and 5 only need be done once. Therefore, it is possible to use GitHub's &lt;a href="https://github.com/actions/cache"&gt;cache action&lt;/a&gt; and generate the dependencies and cache them. Then on the consequent runs, the runner can use the cached version to improve speed.  &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Also, I am looking to be able to get &lt;code&gt;tlmgr&lt;/code&gt; working so that I can customize my LaTeX installation.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Update: I was able to use a docker image to get this working.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;As a next step, it may be possible to separate this workflow into two workflows: one for compiling and saving, and the other for uploading onto Google drive.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Update: I split these two into separate actions.&lt;/p&gt;

&lt;p&gt;However, it should be good enough to get the job done.&lt;/p&gt;
&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;p&gt;Wacky Wildcards&lt;/p&gt;
&lt;h3&gt;
  
  
  Link to Code
&lt;/h3&gt;


&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--A9-wwsHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/ssinad"&gt;
        ssinad
      &lt;/a&gt; / &lt;a href="https://github.com/ssinad/devto-actions-hackathon"&gt;
        devto-actions-hackathon
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      
    &lt;/h3&gt;
  &lt;/div&gt;
  &lt;div class="ltag-github-body"&gt;
    
&lt;div id="readme" class="md"&gt;
&lt;h1&gt;
Compile LaTeX Documents and Upload to Google Drive&lt;/h1&gt;
&lt;h4&gt;
Prerequisites&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;A Google &lt;a href="https://cloud.google.com/iam/docs/service-accounts" rel="nofollow"&gt;service account&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;An encryption tool such as &lt;code&gt;gpg&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Google drive file ID (The file must be shared with the email associated with the service account)&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
Additional Resources / Info&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a href="https://dev.to/ssinad/compile-latex-document-and-upload-to-google-drive-97f" rel="nofollow"&gt;https://dev.to/ssinad/compile-latex-document-and-upload-to-google-drive-97f&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloud.google.com/iam/docs/service-accounts" rel="nofollow"&gt;https://cloud.google.com/iam/docs/service-accounts&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/actions/cache"&gt;https://github.com/actions/cache&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#limits-for-secrets"&gt;https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#limits-for-secrets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://pypi.org/project/google-api-python-client" rel="nofollow"&gt;https://pypi.org/project/google-api-python-client&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;



&lt;/div&gt;
&lt;br&gt;
  &lt;div class="gh-btn-container"&gt;&lt;a class="gh-btn" href="https://github.com/ssinad/devto-actions-hackathon"&gt;View on GitHub&lt;/a&gt;&lt;/div&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;br&gt;


&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://cloud.google.com/iam/docs/service-accounts"&gt;https://cloud.google.com/iam/docs/service-accounts&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/actions/cache"&gt;https://github.com/actions/cache&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#limits-for-secrets"&gt;https://docs.github.com/en/actions/configuring-and-managing-workflows/creating-and-storing-encrypted-secrets#limits-for-secrets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://pypi.org/project/google-api-python-client"&gt;https://pypi.org/project/google-api-python-client&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>actionshackathon</category>
      <category>github</category>
      <category>opensource</category>
      <category>googlecloud</category>
    </item>
  </channel>
</rss>
