| 1 |
on: |
| 2 |
push: |
| 3 |
branches: |
| 4 |
- master |
| 5 |
|
| 6 |
name: Publish Docs |
| 7 |
|
| 8 |
|
| 9 |
permissions: |
| 10 |
contents: write |
| 11 |
|
| 12 |
jobs: |
| 13 |
publish_docs: |
| 14 |
if: github.repository == 'KWARC/rust-libxml' |
| 15 |
name: Publish Docs |
| 16 |
runs-on: ubuntu-latest |
| 17 |
steps: |
| 18 |
- name: install dependencies |
| 19 |
run: | |
| 20 |
sudo apt-get update |
| 21 |
sudo apt-get install -y libxml2-dev |
| 22 |
- name: Set up LIBXML2 env var if compiling with the default bindings |
| 23 |
run: echo "LIBXML2=$(pkg-config libxml-2.0 --variable=libdir)/libxml2.so" >> "$GITHUB_ENV" |
| 24 |
- name: Checkout sources |
| 25 |
uses: actions/checkout@v6 |
| 26 |
- uses: dtolnay/rust-toolchain@stable |
| 27 |
- name: Build Documentation |
| 28 |
run: cargo doc --all --no-deps |
| 29 |
|
| 30 |
- name: Deploy Documentation |
| 31 |
env: |
| 32 |
PUBLISH_BRANCH: gh-pages |
| 33 |
PUBLISH_DIR: ./target/doc |
| 34 |
run: | |
| 35 |
git config user.name "${GITHUB_ACTOR}" |
| 36 |
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" |
| 37 |
git fetch origin ${PUBLISH_BRANCH} |
| 38 |
git checkout ${PUBLISH_BRANCH} |
| 39 |
find "${GITHUB_WORKSPACE}/${PUBLISH_DIR}" -maxdepth 1 | tail -n +2 | xargs -I % cp -rf % "." |
| 40 |
cd ${GITHUB_WORKSPACE} |
| 41 |
git add --all |
| 42 |
git commit --allow-empty -m "Automated deployment: $(date -u) ${GITHUB_SHA}" |
| 43 |
git push origin ${PUBLISH_BRANCH} |