Skip to content

Don't override graph extension factories' default functions (#946) #66

Don't override graph extension factories' default functions (#946)

Don't override graph extension factories' default functions (#946) #66

Workflow file for this run

# Generates and deploys static site to GitHub Pages
# https://docs.github.com/en/pages/getting-started-with-github-pages/using-custom-workflows-with-github-pages
# Reference workflow: https://github.com/actions/starter-workflows/blob/main/pages/jekyll-gh-pages.yml
name: Metro Docs Site
on:
push:
branches: ["main"]
# Allows manual deployements (if needed)
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow pushing to `gh-pages` branch
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Metro docs site build job
docs-site:
runs-on: ubuntu-latest
if: github.repository == 'zacsweers/metro'
steps:
- name: Checkout
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
- name: Configure JDK
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version-file: .github/workflows/.java-version
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
# Only save Gradle User Home state for builds on the 'main' branch.
# Builds on other branches will only read existing entries from the cache.
cache-read-only: ${{ github.ref != 'refs/heads/main' }}
# Don't reuse cache entries from any other Job.
gradle-home-cache-strict-match: true
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Generate API docs
# NOTE: The `dokkaPublications.html` task is pre-configured to generate HTML in `/docs/api`.
run: ./scripts/generate_docs_dokka.sh
env:
GRADLE_OPTS: -Xmx4g # Dokka can be memory intensive, so we increase the heap size
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.13'
- name: Install MkDocs dependencies
run: |
pip install --requirement .github/workflows/mkdocs-requirements.txt
- name: Copy documentation files
run: ./scripts/copy_docs_files.sh
- name: Extract Metro version from gradle.properties
id: version
run: |
METRO_VERSION=$(grep "VERSION_NAME=" gradle.properties | cut -d'=' -f2)
echo "METRO_VERSION=$METRO_VERSION" >> $GITHUB_OUTPUT
echo "Extracted version: $METRO_VERSION"
- name: Validate version format
run: |
VERSION="${{ steps.version.outputs.METRO_VERSION }}"
# Check if version is empty
if [[ -z "$VERSION" ]]; then
echo "ERROR: VERSION_NAME is empty in gradle.properties"
exit 1
fi
# Check if version matches x.y.z or x.y.z-SNAPSHOT pattern
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?$ ]]; then
echo "ERROR: VERSION_NAME '$VERSION' does not match expected format:"
echo " Expected: x.y.z or x.y.z-SNAPSHOT (e.g., 1.2.3 or 1.2.3-SNAPSHOT)"
echo " Actual: $VERSION"
exit 1
fi
echo "Version format is valid: $VERSION"
- name: Configure Git for Mike
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
- name: Fetch gh-pages branch
run: |
# Fetch the gh-pages branch to ensure we have the latest state
git fetch origin gh-pages:gh-pages || echo "gh-pages branch doesn't exist yet (first deployment)"
- name: Deploy SNAPSHOT Docs with mike
if: ${{ success() && contains(steps.version.outputs.METRO_VERSION, 'SNAPSHOT') }}
run: mike deploy --update-aliases --push ${{ steps.version.outputs.METRO_VERSION }} snapshot
- name: Deploy Release Docs with mike
if: ${{ success() && !contains(steps.version.outputs.METRO_VERSION, 'SNAPSHOT') }}
run: |
mike deploy --update-aliases --push ${{ steps.version.outputs.METRO_VERSION }} latest
mike set-default --push latest
# This is important step for first time repo setup with no prior non-snapshot release
- name: Set snapshot as default if no release versions exist
if: ${{ success() && contains(steps.version.outputs.METRO_VERSION, 'SNAPSHOT') }}
run: |
# Check if there are any non-snapshot versions
if ! mike list | grep -v SNAPSHOT | grep -q "[0-9]\+\.[0-9]\+\.[0-9]\+"; then
echo "No release versions found, setting snapshot as default"
mike set-default --push snapshot
else
echo "Release versions exist, keeping current `latest` as default"
fi