From 565b40ab0b5d1ed028ec7bf6a601522fb4bba681 Mon Sep 17 00:00:00 2001 From: yeasy Date: Sun, 5 Apr 2026 08:29:11 -0700 Subject: [PATCH] Add release-pdf CI workflow for automated PDF builds --- .github/workflows/release-pdf.yml | 53 +++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 .github/workflows/release-pdf.yml diff --git a/.github/workflows/release-pdf.yml b/.github/workflows/release-pdf.yml new file mode 100644 index 0000000..f4044cd --- /dev/null +++ b/.github/workflows/release-pdf.yml @@ -0,0 +1,53 @@ +name: Build PDF on Release + +on: + push: + tags: + - 'v*' + workflow_dispatch: + +permissions: + contents: write + +jobs: + build-pdf: + name: Generate PDF + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install Chromium and CJK fonts + run: | + sudo apt-get update + sudo apt-get install -y chromium-browser fonts-noto-cjk fonts-noto-cjk-extra + + - name: Install mdpress (latest) + run: | + LATEST_TAG=$(curl -fsSL -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ github.token }}" https://api.github.com/repos/yeasy/mdpress/releases/latest | jq -r .tag_name) + VERSION="${LATEST_TAG#v}" + echo "Installing mdpress $VERSION" + curl -fsSL "https://github.com/yeasy/mdPress/releases/download/$LATEST_TAG/mdpress_${VERSION}_linux_amd64.tar.gz" -o mdpress.tar.gz + tar xzf mdpress.tar.gz + sudo mv mdpress /usr/local/bin/ + mdpress --version + + - name: Extract tag name + id: tag + run: echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT + + - name: Build PDF + run: mdpress build --format pdf --output docker_practice-${{ steps.tag.outputs.TAG_NAME || 'latest' }}.pdf + + - name: Create Release and upload PDF + if: startsWith(github.ref, 'refs/tags/') + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + files: docker_practice-${{ steps.tag.outputs.TAG_NAME }}.pdf + + - name: Upload PDF as artifact + uses: actions/upload-artifact@v7 + with: + name: docker_practice-pdf + path: "docker_practice-*.pdf"