Nightly Build #55
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: Nightly Build | |
| on: | |
| schedule: | |
| - cron: '0 2 * * *' # Daily at 2 AM UTC | |
| workflow_dispatch: # Manual trigger for testing | |
| jobs: | |
| check-for-changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should-build: ${{ steps.check.outputs.should-build }} | |
| commit-hash: ${{ steps.check.outputs.commit-hash }} | |
| nightly-version: ${{ steps.check.outputs.nightly-version }} | |
| steps: | |
| - name: Checkout develop branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: develop | |
| fetch-depth: 0 | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v2 | |
| with: | |
| version: ${{ vars.UV_VERSION || '0.6.9' }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Check if nightly build needed | |
| id: check | |
| run: uv run scripts/check_nightly_build.py | |
| build-and-publish: | |
| needs: check-for-changes | |
| if: needs.check-for-changes.outputs.should-build == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout develop branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: develop | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v2 | |
| with: | |
| version: ${{ vars.UV_VERSION || '0.6.9' }} | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.10" | |
| - name: Update package versions for nightly | |
| run: | | |
| uv run scripts/update_nightly_versions.py "${{ needs.check-for-changes.outputs.nightly-version }}" | |
| - name: Install dependencies | |
| run: | | |
| uv sync --all-extras | |
| - name: Build packages | |
| run: | | |
| for dir in packages/*/; do | |
| echo "Building $dir" | |
| uv build "$dir" --out-dir dist | |
| done | |
| - name: Sync versions to repo and push tag | |
| run: | | |
| git config user.name "ds-ragbits-robot" | |
| git config user.email "ds-ragbits-robot@users.noreply.github.com" | |
| git add packages/*/pyproject.toml | |
| git commit -m "chore: update package versions for nightly build ${{ env.NIGHTLY_VERSION }}" | |
| git tag "${{ env.NIGHTLY_VERSION }}" | |
| git push origin "${{ env.NIGHTLY_VERSION }}" | |
| git push origin develop | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| NIGHTLY_VERSION: ${{ needs.check-for-changes.outputs.nightly-version }} | |
| - name: Publish to PyPI | |
| run: | | |
| uv tool run twine upload dist/* --verbose | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_REPOSITORY_URL: ${{ vars.PYPI_URL || 'https://test.pypi.org/legacy/' }} | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
| - name: Deploy nightly documentation | |
| shell: bash | |
| run: | | |
| git config user.name "ds-ragbits-robot" | |
| git config user.email "ds-ragbits-robot@users.noreply.github.com" | |
| git fetch origin gh-pages | |
| uv run mike deploy --push --alias-type copy nightly | |
| env: | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: Notify on failure | |
| if: failure() | |
| run: | | |
| echo "Nightly build failed for commit ${{ needs.check-for-changes.outputs.commit-hash }}" | |
| echo "Version attempted: ${{ needs.check-for-changes.outputs.nightly-version }}" |