Update main.yml #91
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
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the main branch | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout repo | |
uses: actions/checkout@v2 | |
# WIP: Download extra fonts | |
# - name: Install TeX Live packages # (Note that you may don't need some of them) | |
# run: sudo apt install -y texlive-base texlive-xetex texlive-lang-chinese latexmk | |
# - name: Download the fonts | |
# run: for i in simhei.ttf simkai.ttf simsun.ttc simsunb.ttf simfang.ttf; do wget -P fonts/ https://xugr.keybase.pub/static/fonts/$i; done | |
# - name: Copy the fonts # In newer version of fontconfig, it reads $HOME/.local/share/fonts/ but not $HOME/.fonts | |
# run: mkdir -p ~/.local/share/fonts && cp -r fonts/* ~/.local/share/fonts/ | |
# - name: Build font information caches | |
# run: fc-cache -rv | |
# format datetime to 'v2021.6.26' | |
- name: Set version number | |
run: | | |
# echo "NOW=$(date +'v%Y.%m.%d')" >> $GITHUB_OUTPUT | |
echo "::set-env name=NOW::$(date +'v%Y.%m.%d')" | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' | |
# compile tex file | |
- name: LaTeX Action | |
uses: xu-cheng/latex-action@v2 | |
with: | |
# The root LaTeX file to be compiled | |
root_file: "resume_${{ env.NOW }}.pdf" | |
latexmk_use_lualatex: true | |
latexmk_shell_escape: true | |
pre_compile: | | |
apk add msttcorefonts-installer fontconfig | |
update-ms-fonts | |
fc-cache -f | |
# check if tag already exists in current day. If so, it will | |
# delete the current tag and replace with the new one | |
# check if tag already exists | |
- name: Check if tag already exists | |
uses: mukunku/[email protected] | |
id: checkTag | |
with: | |
tag: ${{ env.NOW }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# delete tag if exists | |
- name: Remove existing tag ${{ env.NOW }} | |
uses: dev-drprasad/[email protected] | |
if: ${{ steps.checkTag.outputs.exists }} | |
with: | |
delete_release: true # default: false | |
tag_name: ${{ env.NOW }} # tag name to delete | |
repo: anthonyive/resume # target repo (optional). defaults to repo running this action | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# create release | |
- name: Create release ${{ env.NOW }} | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "resume_${{ env.NOW }}.pdf" | |
tag: ${{ env.NOW }} | |
token: ${{ secrets.GITHUB_TOKEN }} |