langs #33
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
# this ends with resume which gets caught by the latter "json resume" entry in https://www.schemastore.org/api/json/catalog.json | |
# see https://github.com/neoclide/coc-yaml/issues/28#issuecomment-784849086 | |
--- | |
name: resume | |
on: | |
workflow_dispatch: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
tectonic_version: 0.15.0 | |
commit_message_resume: "gh-actions: add resume.pdf" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
msg: ${{ steps.build.outputs.msg }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Download Tectonic | |
uses: wtfjoke/setup-tectonic@main | |
with: | |
tectonic-version: ${{ env.tectonic_version }} | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Cache Tectonic | |
uses: actions/cache@v4 | |
env: { cache-name: cache-tectonic } | |
with: | |
path: ~/.cache/Tectonic | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.tex') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: Build our resume | |
id: build | |
run: | | |
./scripts/build.sh | |
echo "msg=${{ env.commit_message_resume }}" >>$GITHUB_OUTPUT | |
- name: Upload PDF | |
uses: actions/upload-artifact@v4 | |
with: | |
name: resume # it'll be zipped :( | |
path: resume.pdf | |
update-website: | |
runs-on: ubuntu-latest | |
needs: [build] | |
if: ${{ needs.build.outputs.msg != '' }} | |
steps: | |
- uses: tibdex/github-app-token@v2 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.CATHY_CLOUD_APP_ID }} | |
private_key: ${{ secrets.CATHY_CLOUD_APP_PRIVATE_KEY }} | |
- uses: actions/checkout@v4 | |
with: | |
repository: andreykaipov/website | |
path: website | |
ref: main | |
token: ${{ steps.generate-token.outputs.token }} | |
- uses: actions/download-artifact@v4 | |
with: | |
name: resume | |
path: website/static | |
- name: Create website PR | |
id: website-pr | |
run: | | |
cd website | |
git config --global user.name "cathy-cloud[bot]" | |
git config --global user.email "154095190+cathy-cloud[bot]@users.noreply.github.com" | |
git checkout -b "${{ env.branch }}" | |
git add . | |
git commit -m "${{ needs.build.outputs.msg }}" | |
git push -fu origin "${{ env.branch }}" | |
if gh pr edit "${{ env.branch }}" -b "${{ env.body }}" -t "${{ env.title}}"; then | |
gh pr reopen "${{ env.branch }}" | |
else | |
gh pr create --fill -B main -H "${{ env.branch }}" | |
fi | |
env: | |
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} | |
branch: auto/resume-${{ github.run_number }} | |
title: Update resume.pdf | |
body: | | |
Automatically generated by GitHub Actions: | |
https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} |