Strauman / travis-latexbuild

Building LaTeX packages using Travis-CI
12 stars 4 forks source link

migration to github actions? #31

Open shabbychef opened 3 years ago

shabbychef commented 3 years ago

Hi,

Given that travis is moving to a subscription model, I need to migrate my CI to github actions. If you think this build can easily be translated, migration directions would be nice, or even just a link.

PHPirates commented 3 years ago

I think this image actually parses the travis yml, so it would probably require some changes there, or you simply provide a fake yml and just create a github actions file which runs the shell file. It's very similar so migration should be easy. Or you can look for inspiration here: https://github.com/PHPirates/travis-ci-latex-pdf#github-actions, I use this one myself: https://github.com/PHPirates/travis-ci-latex-pdf#installing-tex-live-directly

kmilo17pet commented 3 years ago

this is an example using github actions, i hope it can be useful

name: Build LaTeX document
on: [push]
jobs:
  build_latex:
    runs-on: ubuntu-latest
    steps:
      - name: Set up Git repository
        uses: actions/checkout@v2
        with:
          persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
          fetch-depth: 0 # otherwise, you will failed to push refs to dest repo        
      - name: Compile LaTeX document
        uses: dante-ev/latex-action@master
        with:
          root_file: main.tex

      - name: Archive production artifacts
        uses: actions/upload-artifact@v2
        with:
          name: production-pdf
          path: main.pdf
      - name: Generating the production branch
        run: |
          git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
          git config --local user.name "github-actions[bot]"      
          git checkout --orphan production-pdf
          git reset
          git add -f  "*.pdf"
          git status
          git commit -m "pdf file update"
      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          force: true
          branch: production-pdf
shabbychef commented 3 years ago

thanks! I'll give it a try.