Merge pull request #5242 from unisonweb/editor-config-u #1
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 | |
defaults: | |
run: | |
working-directory: unison | |
shell: bash | |
on: | |
push: | |
branches: | |
- trunk | |
jobs: | |
build: | |
name: Haddocks | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
path: unison | |
- name: restore stack caches | |
uses: unisonweb/actions/stack/cache/restore@main | |
with: | |
cache-prefix: haddocks | |
stack-yaml-dir: unison | |
- name: install stack | |
uses: unisonweb/actions/stack/install@main | |
with: | |
stack-version: 2.15.5 | |
- name: build with haddocks | |
working-directory: unison | |
run: stack build --fast --haddock | |
- name: save stack caches | |
uses: unisonweb/actions/stack/cache/save@main | |
with: | |
cache-prefix: haddocks | |
stack-yaml-dir: unison | |
# Haddocks | |
- name: Checkout haddocks branch | |
uses: actions/checkout@v4 | |
with: | |
ref: haddocks | |
path: haddocks | |
# Needed for `git commit` below | |
- name: set git user info | |
working-directory: unison | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "actions@github.com" | |
- name: Copy haddocks | |
working-directory: unison | |
run: | | |
docs_root="$(stack path --local-doc-root)" | |
# Erase any stale files | |
cd "$GITHUB_WORKSPACE"/haddocks | |
rm -rf ./* | |
git checkout --orphan fresh-haddocks-branch | |
cp -r "${docs_root}"/* "$GITHUB_WORKSPACE"/haddocks | |
git add . | |
git commit -m "Regenerated haddocks based on ${GITHUB_SHA}" | |
# Push the branch with only a single commit over the remote | |
git push --force origin fresh-haddocks-branch:haddocks |