1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Release & Publish
on:
release:
types:
workflow_dispatch:
permissions:
contents: read
id-token: write # Essencial para PyPI Trusted Publishing e npm Provenance via Sigstore
jobs:
publish-pypi:
name: 🐍 Publish to PyPI (with Provenance)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libfontconfig1-dev libfreetype6-dev libharfbuzz-dev libclang-dev
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Build Rust Shared Library
run: cargo build --release
- name: Copy Linux library to Python package
run: cp target/release/librasgapdf.so bindings/python/rasgapdf/librasgapdf.so
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Build sdist and wheel
run: |
cd bindings/python
python -m pip install --upgrade pip build twine
python -m build
twine check dist/*
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: bindings/python/dist/
attestations: true
publish-npm:
name: 📦 Publish to npm (with Provenance)
runs-on: ubuntu-latest
needs: publish-pypi
steps:
- uses: actions/checkout@v4
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libfontconfig1-dev libfreetype6-dev libharfbuzz-dev libclang-dev
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Build Rust Shared Library
run: cargo build --release
- name: Copy Linux library to Node package
run: cp target/release/librasgapdf.so bindings/nodejs/librasgapdf.so
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
registry-url: "https://registry.npmjs.org"
- name: Publish to npm with Provenance
run: |
cd bindings/nodejs
npm publish --access public --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
publish-crates:
name: 🦀 Publish to crates.io
runs-on: ubuntu-latest
needs: publish-pypi
steps:
- uses: actions/checkout@v4
- name: Install Linux dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libfontconfig1-dev libfreetype6-dev libharfbuzz-dev libclang-dev
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
- name: Publish to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
sync-huggingface:
name: 🤗 Sync to Hugging Face (Model & Space)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install huggingface_hub
- name: Sync Model Repository and Space to Hugging Face
run: python upload_to_hf.py
env:
HF_TOKEN: ${{ secrets.HF_TOKEN }}