Merge pull request #115 from Holzhaus/dependabot/cargo/thiserror-2.0.3 #87
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
name: Generate Docs | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
docs: | |
name: Update Docs | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Check out repository" | |
uses: actions/checkout@v4 | |
- name: Print Rust version | |
run: rustc -vV | |
- name: Generate Documentation | |
run: cargo doc --all-features --no-deps | |
- name: Generate index file | |
shell: python3 {0} | |
run: | | |
import os | |
package = os.environ["PACKAGE_NAME"] | |
assert package | |
owner, sep, repository = os.environ["GITHUB_REPOSITORY"].partition("/") | |
assert owner | |
assert repository | |
doc = f"""<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Redirecting to https://{owner}.github.io/{repository}/{package}/</title> | |
<meta charset="utf-8"> | |
<meta http-equiv="refresh" content="0; URL=https://{owner}.github.io/{repository}/{package}/"> | |
<link rel="canonical" href="https://{owner}.github.io/{repository}/{package}/"> | |
</head> | |
</html>""" | |
output_dir = os.environ["OUTPUT_DIR"] | |
assert output_dir | |
output_dir = os.path.join(output_dir, "index.html") | |
print(f"Writing to {output_dir}") | |
with open(output_dir, mode="w") as f: | |
f.write(doc) | |
env: | |
PACKAGE_NAME: rekordcrate | |
OUTPUT_DIR: target/doc | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: target/doc |