diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fee4559..b2bafeb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -29,6 +29,22 @@ jobs: fetch-depth: 0 token: ${{ secrets.GITHUB_TOKEN }} + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Install uv + uses: astral-sh/setup-uv@v5 + with: + enable-cache: true + + - name: Update requirements.txt + run: | + echo "# This file was autogenerated by uv via the following command:" > requirements.txt + echo "# uv export --all-extras --no-hashes --format requirements-txt" >> requirements.txt + uv export --all-extras --no-hashes --format requirements-txt >> requirements.txt + - name: Get tag name id: get_tag run: | @@ -178,7 +194,7 @@ jobs: rm -f $NEW_ENTRY_FILE fi - - name: Commit changelog update + - name: Commit changelog and requirements updates env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | @@ -189,13 +205,28 @@ jobs: git checkout main git pull origin main - if git diff --quiet CHANGELOG.md; then - echo "No changes to CHANGELOG.md" + # Check if there are any changes to commit + if git diff --quiet CHANGELOG.md requirements.txt; then + echo "No changes to CHANGELOG.md or requirements.txt" else - git add CHANGELOG.md - git commit -m "docs: update CHANGELOG.md for ${{ steps.get_tag.outputs.tag }}" + git add CHANGELOG.md requirements.txt + + # Create commit message based on what changed + COMMIT_MSG="docs: update for ${{ steps.get_tag.outputs.tag }}" + if ! git diff --quiet --cached CHANGELOG.md; then + COMMIT_MSG="$COMMIT_MSG (CHANGELOG.md" + if ! git diff --quiet --cached requirements.txt; then + COMMIT_MSG="$COMMIT_MSG, requirements.txt)" + else + COMMIT_MSG="$COMMIT_MSG)" + fi + elif ! git diff --quiet --cached requirements.txt; then + COMMIT_MSG="$COMMIT_MSG (requirements.txt)" + fi + + git commit -m "$COMMIT_MSG" git push origin main - echo "✅ CHANGELOG.md updated and pushed to main branch" + echo "✅ Files updated and pushed to main branch" fi build: