Update main.yml #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PDF release (via LaTeX) | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get latest code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '12' # <-- Updated this line to use Node.js version 12 | |
env: | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true # <-- Added this line to allow Node 12 | |
- name: Compile LaTeX | |
run: | | |
latexmk -pdf -file-line-error -halt-on-error -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 "::set-output name=date::$(date +'%Y-%m-%d')" | |
echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" | |
- 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-${{ steps.vars.outputs.date }}-${{ steps.vars.outputs.sha8 }} | |
release_name: Automatic build (version ${{ steps.vars.outputs.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.pdf | |
asset_content_type: application/pdf |