Skip to content

Deploy to GitHub Pages #28

Deploy to GitHub Pages

Deploy to GitHub Pages #28

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches:
- master # Set a branch to deploy
workflow_dispatch:
jobs:
build-index:
permissions:
contents: write # Needed for GH pages updates
runs-on: ubuntu-24.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v5
with:
python-version: "3.13"
- name: Install the package and test dependencies
run: |
uv sync --frozen
- name: Build site
run: |
uv run main.py
- name: Publish pages
if: github.ref == 'refs/heads/master'
run: |
commit=${GITHUB_SHA::7}
version=$(grep '^version' pyproject.toml | cut -d '"' -f2)
git fetch origin gh-pages
git branch gh-pages FETCH_HEAD
git checkout gh-pages
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
rm -rf "${commit}/"
mkdir "$commit"
cp -r build/* "./$commit"
git add "$commit"
version_dir="v${version}"
rm -rf "${version_dir}/"
mkdir "$version_dir"
cp -r build/* "./$version_dir"
git add "$version_dir"
if git diff --cached --quiet; then
echo "No changes to publish, skipping commit."
else
git commit -m "Publish Wheel Variant Index for $commit"
git push --set-upstream origin gh-pages
fi