Generate PDF #20
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: Generate PDF | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'tex/**' | |
tags: | |
- '**' | |
pull_request: | |
paths: | |
- 'tex/**' | |
workflow_run: | |
workflows: ["Tag"] | |
types: | |
- completed | |
env: | |
PDF_NAME: Alicia-Sykes-CV.pdf | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Checkout repository | |
uses: actions/checkout@v2 | |
- name: 🐍 Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: 📦 Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
cd lib && pip install -r requirements.txt | |
- name: 📝 Install LaTeX | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y texlive-full latexmk | |
- name: 📄 Generate PDF | |
run: make | |
- name: 📤 Upload PDF artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: resume-pdf | |
path: out/${{ env.PDF_NAME }} | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: | | |
github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') || | |
github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success' | |
steps: | |
- name: 📥 Checkout repository | |
uses: actions/checkout@v2 | |
- name: 🏷️ Download Tag Artifact | |
if: github.event_name == 'workflow_run' | |
uses: actions/download-artifact@v2 | |
with: | |
name: new | |
path: . | |
continue-on-error: true | |
- name: 🏷️ Determine Tag Name | |
id: determine_tag | |
run: | | |
if [ "${{ github.event_name }}" == "workflow_run" ]; then | |
if [[ -n "${{ github.event.workflow_run.outputs.new_tag }}" ]]; then | |
TAG_NAME="${{ github.event.workflow_run.outputs.new_tag }}" | |
elif [[ -f tag.txt ]]; then | |
TAG_NAME=$(cat tag.txt) | |
else | |
TAG_NAME=$(git describe --tags --abbrev=0 2>/dev/null || echo "0.0.0") | |
fi | |
else | |
NEW_TAG=$(git describe --tags --abbrev=0) | |
fi | |
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV | |
- name: 📤 Download PDF artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: resume-pdf | |
path: out/ | |
- name: 🔑 Set up GitHub CLI | |
run: | | |
echo "${{ secrets.BOT_TOKEN }}" | gh auth login --with-token | |
- name: 📄 Create GitHub Release | |
run: | | |
gh release create "$TAG_NAME" out/${{ env.PDF_NAME }} --title "Release $TAG_NAME" --notes "Generated CV PDF for release $TAG_NAME" |