name: Deploy docs on: push: branches: [main] tags: ['*.*.*'] workflow_dispatch: env: SITE_SLUG: coursebank CRATE: coursebank jobs: deploy: runs-on: pixi-build-rust steps: - uses: actions/checkout@v4 - name: Write the channel switcher run: | cat > "${{ gitea.workspace }}/docs-banner.html" <<'HTML'
Docs channel: release| nightly
HTML - name: Build the API docs env: RUSTDOCFLAGS: "--html-before-content ${{ gitea.workspace }}/docs-banner.html" run: | pixi install --locked pixi run doc-build - name: Redirect the channel root to the crate page run: | printf '%s\n' "" > target/doc/index.html - name: Publish the channel to /srv/www run: | case "${{ gitea.ref }}" in refs/tags/*) channel=release ;; *) channel=nightly ;; esac dest="/srv/www/${SITE_SLUG}/${channel}" mkdir -p "$dest" rsync -a --delete "target/doc/" "$dest/" - name: Point the site root at the latest release, else nightly run: | root="/srv/www/${SITE_SLUG}" if [ -d "$root/release/${CRATE}" ]; then target="release/${CRATE}/" else target="nightly/${CRATE}/" fi printf '%s\n' "" > "$root/index.html"