Refinements, lexical-scope reflection, and definition-site line numbe… #7
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: docs | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - "doc/**" | |
| - "docs/**" | |
| - ".github/workflows/docs.yml" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| MDBOOK_VERSION: v0.5.4 | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install mdBook | |
| run: | | |
| mkdir -p "$RUNNER_TEMP/mdbook" | |
| curl -sSL "https://github.com/rust-lang/mdBook/releases/download/${MDBOOK_VERSION}/mdbook-${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" \ | |
| | tar xz -C "$RUNNER_TEMP/mdbook" | |
| echo "$RUNNER_TEMP/mdbook" >> "$GITHUB_PATH" | |
| - name: Build book | |
| run: bash docs/build.sh | |
| - name: Publish to gh-pages /docs/ | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| GH_PAGES_DIR="$RUNNER_TEMP/gh-pages" | |
| REPO_URL="https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git config --global user.name "github-actions[bot]" | |
| if git ls-remote --exit-code --heads "$REPO_URL" gh-pages > /dev/null 2>&1; then | |
| git clone --depth 1 --branch gh-pages "$REPO_URL" "$GH_PAGES_DIR" | |
| else | |
| mkdir -p "$GH_PAGES_DIR" | |
| git -C "$GH_PAGES_DIR" init -b gh-pages | |
| git -C "$GH_PAGES_DIR" remote add origin "$REPO_URL" | |
| fi | |
| rm -rf "$GH_PAGES_DIR/docs" | |
| cp -r docs/book "$GH_PAGES_DIR/docs" | |
| cd "$GH_PAGES_DIR" | |
| git add -A docs | |
| if git diff --cached --quiet; then | |
| echo "No docs changes to publish." | |
| exit 0 | |
| fi | |
| git commit -m "docs: publish from ${GITHUB_SHA}" | |
| # bench/spec workflows also push to gh-pages; rebase-and-retry on races | |
| for i in 0 1 2 3 4; do | |
| if git push -u origin gh-pages; then | |
| break | |
| fi | |
| git pull --rebase origin gh-pages || true | |
| sleep $((2 ** i)) | |
| done |