Merge pull request #4611 from IntersectMBO/aniketd/fix-haddock-attempt-2 #668
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: Haddocks to GitHub Pages | |
on: | |
push: | |
branches: [ "master" ] | |
workflow_dispatch: | |
jobs: | |
gh-pages: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install Haskell | |
uses: input-output-hk/setup-haskell@v1 | |
id: setup-haskell | |
with: | |
ghc-version: "9.2.8" | |
cabal-version: latest | |
- name: Install system dependencies | |
uses: input-output-hk/actions/base@latest | |
with: | |
use-sodium-vrf: false # default is true | |
- name: Configure to use libsodium | |
run: | | |
cat >> cabal.project <<EOF | |
package cardano-crypto-praos | |
flags: -external-libsodium-vrf | |
EOF | |
- name: Cabal update | |
run: cabal update | |
- name: Build haddocks | |
run: scripts/haddocks.sh haddocks all | |
- name: Add files | |
run: | | |
git config --local user.name ${{ github.actor }} | |
git config --local user.email "${{ github.actor }}@users.noreply.github.com" | |
# Start a new version of the gh-pages branch | |
git for-each-ref refs/heads/gh-pages --format='%(refname:short)' | | |
while read -r REFNAME; do | |
git branch -D "$REFNAME" | |
done | |
git checkout -b gh-pages | |
git rm -rfq . | |
git commit -qm "Remove all existing files" | |
echo "cardano-ledger.cardano.intersectmbo.org" >CNAME | |
touch .nojekyll | |
git add CNAME .nojekyll | |
git commit -qm "Add CNAME and .nojekyll" | |
# Preserve benchmark results, if any | |
git ls-remote origin --heads gh-pages | | |
while read -r _SHA REFNAME; do | |
git fetch origin "$REFNAME" | |
if git diff --name-only FETCH_HEAD -- dev | grep -q .; then | |
git checkout FETCH_HEAD dev | |
git commit -qC "$(git log -1 --format=%H FETCH_HEAD dev)" | |
fi | |
done | |
# Add Haddocks | |
git add -A --force ./haddocks | |
git mv ./haddocks/* . | |
git commit -qm "Updated from ${GITHUB_SHA} via ${GITHUB_EVENT_NAME}" | |
- name: Push to gh-pages | |
uses: ad-m/github-push-action@v0.8.0 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
force: true | |
directory: . |