Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hax home page using mkdocs #1225

Merged
merged 21 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 16 additions & 88 deletions .github/workflows/gh_pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,23 @@ on:
branches: [main]

jobs:
build-documentation:
# Build job
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build docs
run: nix build .#hax.docs --out-link ./_site
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2

# deploys the result of `build`
# this job is a copy paste from <https://github.com/actions/deploy-pages>
deploy-documentation:
# Add a dependency to the build job
needs: build-documentation

# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
- uses: actions/checkout@v3
W95Psp marked this conversation as resolved.
Show resolved Hide resolved
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build documentation
run: nix build .#docs
- name: Upload static files as artifact
id: deployment
uses: actions/upload-pages-artifact@v3
with:
path: result/
# Deploy job
deploy:
needs: build
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
Expand All @@ -38,75 +37,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action

# Builds and deploy "external" GH pages: pushes to the repos
# `hacspec/hacspec.github.io` and `hacspec/book`
build-and-deploy-external-gh-pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: hax
- uses: actions/checkout@v4
with:
repository: "hacspec/hacspec.github.io"
path: hacspec.github.io
token: ${{secrets.PUSH_HACSPEC_GITHUB_TOKEN}}
- uses: actions/checkout@v4
with:
repository: "hacspec/book"
path: book
token: ${{secrets.PUSH_HACSPEC_GITHUB_TOKEN}}

- uses: DeterminateSystems/nix-installer-action@main

- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

- name: Patch and push `README.md` in `hacspec.github.io`
run: |
(
README_ORIGINAL="https://github.com/hacspec/hax/blob/main/README.md"
echo "<!-- WARNING: a GitHub action periodically replaces this file with ${README_ORIGINAL}. Do not make any modification to this file, instead make a PR to ${README_ORIGINAL} -->"
echo ""
cat hax/README.md
) > hacspec.github.io/README.md
cd hacspec.github.io

# Replace the `🌐 Website` link to a GitHub link
sed -i 's#.*🌐 Website.*# <a href="https://github.com/hacspec/hax">🔗 GitHub</a> |#' README.md

# Replace relative links to absolute links
sed -i 's|(\./|(https://github.com/hacspec/hax/tree/main/|g' README.md

git add -A
if git commit -m "Readme update"; then
git push https://$USERNAME:[email protected]/hacspec/hacspec.github.io
fi

- name: Regenerate and push the book
run: |
nix build ./hax#hax-book -o result-hax-book
HAX_COMMIT=$(git -C ./hax rev-parse --short HEAD)

mkdir hax-book
rsync -rq --no-perms --chown=$(id -un):$(id -gn) "$(realpath result-hax-book)/" hax-book
mv book/.git hax-book/.git
cd hax-book

{
echo "# Warning: this repository only contains generated files"
echo "The sources of the book are in https://github.com/hacspec/hax/tree/main/book"
echo "Please file issues, and push PRs to https://github.com/hacspec/hax."
} > README.md

git add -A
if git commit -m "Book update (generated from hacspec/hax@$HAX_COMMIT)"; then
git push https://$USERNAME:[email protected]/hacspec/book
fi
env:
PUSH_HACSPEC_GITHUB_TOKEN: ${{secrets.PUSH_HACSPEC_GITHUB_TOKEN}}
USERNAME: github-actions[bot]
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action
W95Psp marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 0 additions & 2 deletions book/.gitignore

This file was deleted.

9 changes: 0 additions & 9 deletions book/archive/book.toml

This file was deleted.

22 changes: 0 additions & 22 deletions book/archive/src/SUMMARY.md

This file was deleted.

152 changes: 0 additions & 152 deletions book/archive/src/developers/compiler.md

This file was deleted.

Binary file removed book/archive/src/developers/hacspec_architecture.png
Binary file not shown.
4 changes: 0 additions & 4 deletions book/archive/src/developers/readme.md

This file was deleted.

13 changes: 0 additions & 13 deletions book/archive/src/examples/readme.md

This file was deleted.

Loading
Loading