Skip to content

Update main.yml

Update main.yml #12

Workflow file for this run

name: Build and Deploy LaTeX PDF
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
container: docker://blang/latex:ubuntu
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Compile LaTeX
run: xelatex -interaction=nonstopmode main.tex
- name: Upload PDF artifact
uses: actions/upload-artifact@v2
with:
name: pdf_file
path: main.pdf
deploy:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: [build]
steps:
- name: Set variables
id: vars
run: |
echo "DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
echo "SHA8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_ENV
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: pdf_file
- name: Create release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: main-${{ env.DATE }}-${{ env.SHA8 }}
release_name: Automatic build (version ${{ env.DATE }})
draft: false
prerelease: false
- name: Upload PDF asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./main.pdf
asset_name: main-${{ env.DATE }}-${{ env.SHA8 }}.pdf
asset_content_type: application/pdf