From 1ce18a4cd74cd9c373fd24dadea0d38f2422b07d Mon Sep 17 00:00:00 2001 From: Klagarge Date: Sat, 14 Feb 2026 01:48:39 +0100 Subject: [PATCH] ci: add ci Co-authored-by: Claude --- .github/workflows/build-release.yaml | 81 ++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 .github/workflows/build-release.yaml diff --git a/.github/workflows/build-release.yaml b/.github/workflows/build-release.yaml new file mode 100644 index 0000000..2ca40e5 --- /dev/null +++ b/.github/workflows/build-release.yaml @@ -0,0 +1,81 @@ +name: Build PDF & Release +run-name: Build PDF and Release ${{ github.ref_name }} + +on: + push: + branches: + - main + paths: + - '**.md' + - '.gitea/workflows/**' + - 'md-pdf.ron' + +jobs: + release: + runs-on: ubuntu-latest + permissions: + contents: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install Fonts + run: | + sudo apt-get update + sudo apt-get install -y fonts-liberation + + - name: Install Rust + uses: dtolnay/rust-toolchain@stable + + - name: Setup Rust cache + uses: swatinem/rust-cache@v2 + + - name: Install Typst + run: | + mkdir -p /usr/local/bin + curl -L -o typst.tar.xz https://github.com/typst/typst/releases/latest/download/typst-x86_64-unknown-linux-musl.tar.xz + tar -xJf typst.tar.xz --strip-components=1 -C /usr/local/bin/ typst-x86_64-unknown-linux-musl/typst + typst --version + + - name: Install Typst & md-pdf (Rust) + run: | + cargo install md-pdf + echo "$HOME/.cargo/bin" >> $GITHUB_PATH + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Install svu (Go) + run: go install github.com/caarlos0/svu@latest + + - name: Build PDF + run: | + md-pdf README.md + mv README.pdf PIS.pdf + + # Calculate version based on commit messages (fix, feat, breaking) + - name: Calculate Next Version + id: version + run: | + NEW_TAG=$(svu next) + echo "tag=$NEW_TAG" >> $GITHUB_OUTPUT + echo "Next version : $NEW_TAG" + + # Create release and upload PDF + # Note: softprops works very well on recent Gitea + - name: Create Release + uses: softprops/action-gh-release@v2 + if: ${{ steps.version.outputs.tag != '' }} # Safety check + with: + tag_name: ${{ steps.version.outputs.tag }} + name: Release ${{ steps.version.outputs.tag }} + files: PIS.pdf + draft: false + prerelease: false + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file