From a9b0da72088ad090dcf0df43f314a2b7176e38cf Mon Sep 17 00:00:00 2001 From: appleb_m Date: Tue, 31 Mar 2026 13:44:54 +0200 Subject: [PATCH] Update .gitea/workflows/action.yaml --- .gitea/workflows/action.yaml | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/action.yaml b/.gitea/workflows/action.yaml index 775f4148..27ec0d4e 100644 --- a/.gitea/workflows/action.yaml +++ b/.gitea/workflows/action.yaml @@ -25,13 +25,23 @@ jobs: steps: - name: Checkout Repository uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Cache pip + uses: actions/cache@v4 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml') }} - name: Set Up Python Environment + uses: actions/setup-python@v4 + with: + python-version: '3.12' run: | python3 -m venv venv # Create a virtual environment source venv/bin/activate pip install twine build - mkdir dist/ - name: Build the package run: | @@ -39,7 +49,7 @@ jobs: python -m build - name: Upload Package to Gitea PyPI - if: github.ref == 'refs/heads/master' && contains(github.event.head_commit.message, 'build and publish') + if: startsWith(github.ref, 'refs/tags/') env: TWINE_USERNAME: "__token__" # Username for Twine when using token-based auth TWINE_PASSWORD: ${{ secrets.PIP_REPOSITORY_API_TOKEN }} # Use the secret for authentication @@ -67,7 +77,6 @@ jobs: working-directory: docs run: | git fetch origin master:master || true - git checkout master || true python3 -m venv venv source venv/bin/activate @@ -99,16 +108,18 @@ jobs: # with the generated daq/docs/_build/html. This keeps only the documentation # on the gitea-pages branch. # Confirm build output exists (relative to repository root) - BUILD_DIR="daq/docs/_build/html" + BUILD_DIR="docs/_build/html" echo "Checking build output at: $BUILD_DIR" + if [ ! -d "$BUILD_DIR" ] || [ -z "$(ls -A "$BUILD_DIR")" ]; then echo "ERROR: $BUILD_DIR does not exist or is empty" echo "Listing docs/:" ls -la docs || true - echo "Listing daq/docs/_build:" - ls -la daq/docs/_build || true + echo "Listing docs/_build:" + ls -la docs/_build || true exit 1 fi + # Work in a temporary clone to avoid touching the runner workspace TMPDIR=$(mktemp -d) REPO_URL="https://$DEPLOY_TOKEN@gitea.psi.ch/${{ github.repository }}"