This repository has been archived by the owner on Mar 4, 2024. It is now read-only.
Backport #840 #1819
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: [master] | |
pull_request: | |
workflow_dispatch: | |
release: | |
types: [published] | |
name: docs | |
jobs: | |
docs: | |
runs-on: ubuntu-22.04 | |
name: build | |
container: | |
image: ghcr.io/gtk-rs/gtk3-rs/gtk3:latest | |
env: | |
RELEASES: | | |
0.17=0.17 | |
0.16=0.16 | |
0.15=0.15 | |
0.14=0.14 | |
RUSTFLAGS: --cfg docsrs | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
submodules: recursive | |
set-safe-directory: true | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
override: true | |
components: rustfmt | |
- run: git submodule update --checkout | |
- run: cargo install rustdoc-stripper | |
- run: python3 ./generator.py --embed-docs --yes ./ | |
- run: git clone https://gitlab.gnome.org/World/Rust/gir-rustdoc/ # checkout action doesn't support random urls | |
- run: echo "RUSTDOCFLAGS=$(eval python3 ./gir-rustdoc/gir-rustdoc.py --pages-url 'https://gtk-rs.org/gtk3-rs/' --default-branch 'master' pre-docs | xargs)" >> ${GITHUB_ENV} | |
env: | |
RUSTDOCFLAGS: > | |
-Zunstable-options --generate-link-to-definition | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: doc | |
args: -p atk -p atk-sys -p gdk -p gdk-sys -p gdkx11 -p gdkx11-sys -p gtk -p gtk3-macros -p gtk-sys -p gdkwayland -p gdkwayland-sys --no-deps --all-features | |
- run: echo "RELEASE=$(echo '${{ github.event.release.tag_name }}' | grep -Po '(\d+)\.(\d+)')" >> ${GITHUB_ENV} | |
- run: echo "DEST=$(if [ "$GITHUB_EVENT_NAME" == "release" ]; then echo 'stable/${{ env.RELEASE }}'; else echo 'git'; fi)" >> ${GITHUB_ENV} | |
- name: Grab gtk-rs LOGO | |
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'release' }} | |
run: | | |
wget https://raw.githubusercontent.com/gtk-rs/gtk-rs.github.io/master/logo/gtk-rs-16.png -O ./target/doc/favicon-16x16.png | |
wget https://raw.githubusercontent.com/gtk-rs/gtk-rs.github.io/master/logo/gtk-rs-32.png -O ./target/doc/favicon-32x32.png | |
wget https://raw.githubusercontent.com/gtk-rs/gtk-rs.github.io/master/logo/gtk-rs-256.png -O ./target/doc/rust-logo.png | |
wget https://raw.githubusercontent.com/gtk-rs/gtk-rs.github.io/master/logo/gtk-rs.svg -O ./target/doc/rust-logo.svg | |
wget https://raw.githubusercontent.com/gtk-rs/gtk-rs.github.io/master/logo/gtk-rs.svg -O ./target/doc/favicon.svg | |
- name: deploy | |
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/master') || github.event_name == 'release' }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./target/doc/ | |
keep_files: false | |
destination_dir: ${{ env.DEST }}/docs | |
- run: python3 ./gir-rustdoc/gir-rustdoc.py --project-title 'GTK 3 Rust bindings' html-index | |
- name: deploy index page | |
uses: peaceiris/actions-gh-pages@v3 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public/ | |
keep_files: true | |
destination_dir: ./ |