name: Release PDFs on: release: types: [published] jobs: pdfs: # Host executor (runs on kasse as gitea-runner) using fish; pandoc/typst/jq are on the host. # Replaces the retired Woodpecker `local` backend. runs-on: fish defaults: run: shell: fish {0} steps: - name: Checkout code uses: https://gitea.com/actions/checkout@v6 - name: Render markdown to PDF and attach to the release env: TOKEN: ${{ github.token }} run: | mkdir -p dist curl -sLo icon.svg https://klingenbergbygg.no/icon-normalized.svg for md in (find . -name "*.md" ! -path "./.git/*") pandoc -f gfm+tex_math_dollars -t pdf -o "dist/$(basename $md .md).pdf" --pdf-engine=typst --template=stil.typ $md end set REL_ID (curl --silent --fail --header "Authorization: token $TOKEN" "$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases/tags/$GITHUB_REF_NAME" | jq -r '.id') for pdf in (find dist -name '*.pdf') curl --silent --show-error --fail --header "Authorization: token $TOKEN" --form "attachment=@$pdf" "$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY/releases/$REL_ID/assets?name=$(basename $pdf)" end