Nightly pre-release on PyPI #215
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 pre-release on PyPI | |
| on: | |
| schedule: | |
| # Run at midnight UTC every day | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: | |
| env: | |
| HATCH_VERSION: "1.16.5" | |
| permissions: | |
| contents: read | |
| jobs: | |
| nightly-release: | |
| runs-on: ubuntu-latest | |
| environment: pypi | |
| permissions: | |
| id-token: write | |
| # Always build from main for consistency (scheduled and manual runs) | |
| steps: | |
| - name: Checkout main | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| persist-credentials: false | |
| ref: main | |
| fetch-depth: 1 | |
| # Reads VERSION.txt, strips any -rcN suffix, and appends .devYYYYMMDDHHMMSS | |
| # (e.g. 2.25.0.dev20250217000000) so each run gets a unique, PEP 440–valid pre-release version. | |
| - name: Set nightly version | |
| id: set-version | |
| run: | | |
| BASE_VERSION=$(sed 's/-rc[0-9]*$//' VERSION.txt) | |
| TIMESTAMP=$(date +%Y%m%d%H%M%S) | |
| NIGHTLY_VERSION="${BASE_VERSION}.dev${TIMESTAMP}" | |
| echo "version=${NIGHTLY_VERSION}" >> "$GITHUB_OUTPUT" | |
| echo "${NIGHTLY_VERSION}" > VERSION.txt | |
| echo "Building haystack-ai version: ${NIGHTLY_VERSION}" | |
| - name: Install Hatch | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install hatch==${{ env.HATCH_VERSION }} --uploaded-prior-to=P1D | |
| - name: Build Haystack | |
| run: hatch build | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33 # v1.14.2 |