re: use docker image with latest tag #53
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: Resume Builder | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "resume/*.py" | |
- ".github/workflows/resume.yml" | |
- "src/resumake/utils.py" | |
- "src/resumake/template/resume.css" | |
- "src/resumake/template/resume.html" | |
- "src/resumake/template/index.html" | |
# Allows running this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
generate-resume: | |
name: Generate Resume | |
container: cybardev/resumake-env | |
runs-on: ubuntu-latest | |
outputs: | |
changed: ${{ steps.check_updates.outputs.changed }} | |
skip: ${{ steps.generate.outputs.skip }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Run resume generation script | |
id: generate | |
run: | | |
RESUME_SCRIPT="./resume/${{ github.repository_owner }}.py" | |
if [ -f "${RESUME_SCRIPT}" ]; then | |
export PYTHONPATH=$PYTHONPATH:$PWD/src/ | |
python3 -m resumake.builder ${RESUME_SCRIPT} -o ./static/assets | |
FILENAME=$(basename $(ls ./static/assets/Resume_*.pdf) .pdf) | |
echo | pandoc -t html --template=./src/resumake/template/index.html --metadata title="${FILENAME}" --variable filename="${FILENAME}" -o ./static/index.html | |
echo "skip=false" >> "${GITHUB_OUTPUT}" | |
else | |
echo "File '${RESUME_SCRIPT}' not found. Couldn't build resume." | |
echo "skip=true" >> "${GITHUB_OUTPUT}" | |
fi | |
- name: Check for resume changes | |
id: check_updates | |
if: steps.generate.outputs.skip == 'false' | |
run: | | |
RESUME_CHANGED=$(git diff ./static/assets | grep md | head -n 1) | |
INDEX_CHANGED=$(git diff ./static | grep index.html | head -n 1) | |
UPDATE=$(python3 -c "print(str('${RESUME_CHANGED}'.endswith('.md') or '${INDEX_CHANGED}'.endswith('html')).lower())") | |
echo "Re-upload resume: ${UPDATE}" | |
echo "changed=${UPDATE}" >> "${GITHUB_OUTPUT}" | |
- name: Commit changes | |
if: steps.generate.outputs.skip == 'false' && steps.check_updates.outputs.changed == 'true' | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git commit -a -m "pipeline: update resume" | |
- name: Upload resume files | |
if: steps.generate.outputs.skip == 'false' && steps.check_updates.outputs.changed == 'true' | |
uses: ad-m/github-push-action@master | |
with: | |
branch: main | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish-site: | |
name: Publish Site | |
needs: generate-resume | |
if: needs.generate-resume.outputs.skip == 'false' && needs.generate-resume.outputs.changed == 'true' | |
uses: ./.github/workflows/website.yml |