More CI/CD Debugging and that only Runs for Releases #31
Workflow file for this run
This file contains hidden or 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: Build Resume | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| workflow_dispatch: | |
| release: | |
| types: [published] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| env: | |
| FILE: morgan_watson_morris_resume.pdf | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download and Unzip Archive | |
| run: | | |
| # Define variables for clarity | |
| DOWNLOAD_URL="https://www.gust.org.pl/projects/e-foundry/tex-gyre/heros/qhv2.004otf.zip" | |
| OUTPUT_FILE="tex-gyre-hero.zip" | |
| EXTRACT_DIR="tex_gyre_hero_fonts" | |
| # Use curl to download the file to the specified output file | |
| curl -sSL "$DOWNLOAD_URL" -o "$OUTPUT_FILE" | |
| # Create the extraction directory | |
| mkdir -p "$EXTRACT_DIR" | |
| # Unzip the archive into the specified directory | |
| unzip "$OUTPUT_FILE" -d "$EXTRACT_DIR" | |
| # Optional: Remove the downloaded zip file | |
| rm "$OUTPUT_FILE" | |
| - name: Verify extracted files | |
| run: ls -R tex_gyre_hero_fonts | |
| - name: Install Typst | |
| uses: typst-community/setup-typst@v2 | |
| with: | |
| version: latest | |
| - name: Compile resume | |
| run: typst compile resume.typ ${{ env.FILE }} --font-path ./tex_gyre_hero_fonts | |
| - name: Upload PDF artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: resume-pdf | |
| path: ${{ env.FILE }} | |
| retention-days: 30 | |
| - name: Attach to Release | |
| if: github.event_name == 'release' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const fs = require("fs").promises; | |
| const { repo: { owner, repo }, sha } = context; | |
| const file = "${{ env.FILE }}"; | |
| const release = await github.rest.repos.getReleaseByTag({ | |
| owner, repo, | |
| tag: process.env.GITHUB_REF.replace("refs/tags/", ""), | |
| }); | |
| console.log("Release:", { release }); | |
| console.log("File:", { file }) | |
| await github.rest.repos.uploadReleaseAsset({ | |
| owner, repo, | |
| release_id: release.data.id, | |
| name: file, | |
| data: await fs.readFile(file), | |
| }); |