Skip to content

Make pre-commit hook only check affected subprojects #6

Make pre-commit hook only check affected subprojects

Make pre-commit hook only check affected subprojects #6

Workflow file for this run

name: Deploy Documentation
on:
push:
branches: [main]
paths:
- 'docs/**'
- 'modules/core/src/**'
- '.github/workflows/pages.yml'
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true
working-directory: docs
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'sbt'
- name: Setup sbt
uses: sbt/setup-sbt@v1
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Extract version from sbt
id: version
run: |
# Get version from sbt-dynver
VERSION=$(sbt -no-colors 'print version' | tail -1 | tr -d '\n')
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Detected version: $VERSION"
# Update the project data file with actual version
sed -i "s/^version:.*/version: \"$VERSION\"/" docs/_data/project.yml
sed -i "s/^latest_release:.*/latest_release: \"$VERSION\"/" docs/_data/project.yml
echo "Updated docs/_data/project.yml:"
cat docs/_data/project.yml
- name: Generate Scaladoc
run: |
# Generate Scaladoc for both Scala versions
sbt "core/doc"
# Find the generated doc directory (use Scala 3 by default)
SCALADOC_DIR=$(find modules/core/target -name "api" -type d | grep "scala-3" | head -1)
if [ -z "$SCALADOC_DIR" ]; then
# Fall back to Scala 2.13 if Scala 3 not found
SCALADOC_DIR=$(find modules/core/target -name "api" -type d | head -1)
fi
echo "Scaladoc directory: $SCALADOC_DIR"
# Create scaladoc directory in docs
mkdir -p docs/scaladoc
# Copy Scaladoc to docs
if [ -n "$SCALADOC_DIR" ] && [ -d "$SCALADOC_DIR" ]; then
cp -r "$SCALADOC_DIR"/* docs/scaladoc/
echo "Scaladoc copied successfully"
ls -la docs/scaladoc/
else
echo "Warning: Scaladoc directory not found"
echo "<html><body><h1>Scaladoc</h1><p>API documentation will be available after the next release.</p></body></html>" > docs/scaladoc/index.html
fi
- name: Build Jekyll site
working-directory: docs
run: |
bundle install
bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/_site
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4