Add throwables() and incompletes() collection helpers (#35) #69
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: Publish documentation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v* | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: gh-pages-deploy-${{ startsWith(github.ref, 'refs/tags/') && 'stable' || 'dev' }} | |
| cancel-in-progress: false | |
| jobs: | |
| deploy_docs: | |
| if: github.repository == 'mrmans0n/asyncresult' | |
| runs-on: ubuntu-latest | |
| env: | |
| TERM: dumb | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup JDK | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| - uses: gradle/actions/setup-gradle@v5 | |
| - name: Generate API docs | |
| run: ./gradlew :dokkaGenerate | |
| - name: Setup uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install dependencies | |
| run: uv sync --frozen | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Fetch gh-pages branch | |
| run: git fetch origin gh-pages:gh-pages || true | |
| - name: Determine version | |
| id: version | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
| # Extract version from tag (remove 'v' prefix) | |
| VERSION="${GITHUB_REF#refs/tags/v}" | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "alias=latest" >> $GITHUB_OUTPUT | |
| echo "is_stable=true" >> $GITHUB_OUTPUT | |
| else | |
| # Main branch = next/development version | |
| echo "version=next" >> $GITHUB_OUTPUT | |
| echo "alias=" >> $GITHUB_OUTPUT | |
| echo "is_stable=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Deploy documentation (stable version) | |
| if: steps.version.outputs.is_stable == 'true' | |
| run: | | |
| uv run mike deploy --push --update-aliases ${{ steps.version.outputs.version }} ${{ steps.version.outputs.alias }} | |
| uv run mike set-default --push latest | |
| - name: Deploy documentation (development version) | |
| if: steps.version.outputs.is_stable == 'false' | |
| run: | | |
| uv run mike deploy --push ${{ steps.version.outputs.version }} | |
| - name: Check and deploy missing stable version | |
| if: steps.version.outputs.is_stable == 'false' | |
| run: | | |
| # Get the latest stable tag | |
| LATEST_TAG=$(git tag -l 'v*' --sort=-v:refname | head -n1) | |
| if [[ -z "$LATEST_TAG" ]]; then | |
| echo "No stable tags found, skipping" | |
| exit 0 | |
| fi | |
| LATEST_VERSION="${LATEST_TAG#v}" | |
| echo "Latest stable version: $LATEST_VERSION" | |
| # Check if this version exists in mike's versions | |
| git fetch origin gh-pages:gh-pages || true | |
| if git show gh-pages:versions.json 2>/dev/null | grep -q "\"version\": \"$LATEST_VERSION\""; then | |
| echo "Stable version $LATEST_VERSION already deployed, skipping" | |
| exit 0 | |
| fi | |
| echo "Stable version $LATEST_VERSION not found, deploying..." | |
| # Checkout the stable tag | |
| git checkout "$LATEST_TAG" | |
| # Rebuild docs for stable version | |
| ./gradlew :dokkaGenerate | |
| # Deploy stable version | |
| uv run mike deploy --push --update-aliases "$LATEST_VERSION" latest | |
| uv run mike set-default --push latest |