diff --git a/.github/workflows/v3_pypi_release.yml b/.github/workflows/v3_pypi_release.yml new file mode 100644 index 0000000000..337b77d606 --- /dev/null +++ b/.github/workflows/v3_pypi_release.yml @@ -0,0 +1,43 @@ +name: Manual pre-release from v3 on PyPI + +on: + workflow_dispatch: + +env: + HATCH_VERSION: "1.16.5" + +jobs: + v3-release: + runs-on: ubuntu-latest + environment: pypi + permissions: + id-token: write + steps: + - name: Checkout v3 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + ref: v3 + fetch-depth: 1 + + # Reads VERSION.txt, strips any -rcN suffix, and appends .devYYYYMMDDHHMMSS + # (e.g. 3.0.0.dev20260519000000) so each run gets a unique, PEP 440–valid pre-release version. + - name: Set pre-release version + id: set-version + run: | + BASE_VERSION=$(sed 's/-rc[0-9]*$//' VERSION.txt) + TIMESTAMP=$(date +%Y%m%d%H%M%S) + PRERELEASE_VERSION="${BASE_VERSION}.dev${TIMESTAMP}" + echo "version=${PRERELEASE_VERSION}" >> "$GITHUB_OUTPUT" + echo "${PRERELEASE_VERSION}" > VERSION.txt + echo "Building haystack-ai version: ${PRERELEASE_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@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0