Skip to content

Release: v1.0.0.rc5 #34

Release: v1.0.0.rc5

Release: v1.0.0.rc5 #34

name: Python prerelease
on:
push:
tags:
- v*rc*
workflow_dispatch:
inputs:
tag:
description: "Tag to test (e.g., 0.30.0rc2)"
required: true
jobs:
trigger_rc_testing:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target-repo: ["transformers", "datasets", "diffusers"]
steps:
- name: Determine version from tag
id: get-version
env:
TAG : ${{ inputs.tag }}
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "VERSION=$TAG" >> $GITHUB_OUTPUT
else
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Checkout target repo
uses: actions/checkout@v4
with:
repository: huggingface/${{ matrix.target-repo }}
path: ${{ matrix.target-repo }}
token: ${{ secrets.HUGGINGFACE_HUB_AUTOMATIC_RC_TESTING }}
- name: Configure Git
run: |
cd ${{ matrix.target-repo }}
git config user.name "Hugging Face Bot (RC Testing)"
git config user.email "[email protected]"
- name: Wait for prerelease to be out on PyPI
run: |
VERSION=${{ steps.get-version.outputs.VERSION }}
echo "Waiting for huggingface-hub==${VERSION} to be available on PyPI"
while ! pip install huggingface-hub==${VERSION}; do
echo "huggingface-hub==${VERSION} not available yet, retrying in 15s"
sleep 15
done
- name: Create test branch and update dependencies
id: create-pr
run: |
cd ${{ matrix.target-repo }}
VERSION=${{ steps.get-version.outputs.VERSION }}
BRANCH_NAME="ci-test-huggingface-hub-${VERSION}-release"
# Create and checkout new branch
git checkout -b $BRANCH_NAME
# Update dependencies using sed
sed -i -E "s/\"huggingface-hub>=0.*\"/\"huggingface-hub==${VERSION}\"/" setup.py
git add setup.py
# Only if the target repo is transformers
if [ "${{ matrix.target-repo }}" = "transformers" ]; then
sed -i -E "s/\"huggingface-hub>=0.*\"/\"huggingface-hub==${VERSION}\"/" src/transformers/dependency_versions_table.py
git add src/transformers/dependency_versions_table.py
fi
# Only if the target repo is diffusers
if [ "${{ matrix.target-repo }}" = "diffusers" ]; then
sed -i -E "s/\"huggingface-hub\":.*/\"huggingface-hub\": \"huggingface-hub==${VERSION}\",/" src/diffusers/dependency_versions_table.py
git add src/diffusers/dependency_versions_table.py
fi
# Any line with `uv pip install --prerelease=allow` in the `.github/` folder must be updated with `--prerelease=allow` flag
find .github/workflows/ -type f -exec sed -i 's/uv pip install /uv pip install --prerelease=allow /g' {} +
git add .github/workflows/
# Commit and push changes
git --no-pager diff --staged
git commit -m "Test hfh ${VERSION}"
git push --set-upstream origin $BRANCH_NAME
- name: Print URLs for manual check
run: |
VERSION=${{ steps.get-version.outputs.VERSION }}
echo "https://github.com/huggingface/${{ matrix.target-repo }}/actions"
echo "https://github.com/huggingface/${{ matrix.target-repo }}/compare/main...${BRANCH_NAME}"