Merge pull request #536 from perturbing/perturbing/add-msm-bls-clean #97
This file contains hidden or 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: "3.12" | |
- 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 | |
# Save generated output as an artifact | |
- name: Archive haddocks directory | |
run: tar -czf haddocks.tgz haddocks | |
- name: Upload haddocks artifact | |
# upload-artifact is pinned to avoid a bug in download-artifact | |
# See https://github.com/actions/download-artifact/issues/328 | |
uses: actions/[email protected] | |
with: | |
name: haddocks | |
path: haddocks.tgz | |
overwrite: true | |
retention-days: 1 | |
- name: Add files | |
if: github.event_name == 'push' && github.ref_name == 'master' | |
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-base.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 | |
if: github.event_name == 'push' && github.ref_name == 'master' | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
branch: gh-pages | |
force: true | |
directory: . |