From bc914aadc7308c3ff2db0a604a11d17a5ff03e26 Mon Sep 17 00:00:00 2001 From: kamilbenkirane Date: Fri, 5 Dec 2025 09:58:31 +0100 Subject: [PATCH] fix: detect changes correctly when pushing tags Fix the publish workflow to properly detect changes when pushing tags. Tag pushes don't have github.event.before, so we now compare against the previous tag instead. This ensures integration tests and publish jobs run correctly for tag-based releases. --- .github/workflows/publish.yml | 43 ++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index ef3aacc3..d5b32704 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -51,10 +51,22 @@ jobs: - uses: actions/checkout@v4 with: fetch-depth: 0 + - id: get-base + run: | + # Get previous tag to compare against (tag pushes don't have github.event.before) + PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") + if [ -z "$PREVIOUS_TAG" ]; then + echo "base=" >> $GITHUB_OUTPUT + echo "run-all=true" >> $GITHUB_OUTPUT + else + echo "base=$PREVIOUS_TAG" >> $GITHUB_OUTPUT + echo "run-all=false" >> $GITHUB_OUTPUT + fi - uses: dorny/paths-filter@v3 id: filter + if: steps.get-base.outputs.run-all != 'true' with: - base: ${{ github.event.before }} + base: ${{ steps.get-base.outputs.base }} filters: | text-generation: - 'packages/text-generation/**' @@ -69,19 +81,24 @@ jobs: - id: build-matrix run: | PACKAGES=() - CORE="${{ steps.filter.outputs.core }}" - if [[ "$CORE" == "true" || "${{ steps.filter.outputs.text-generation }}" == "true" ]]; then - PACKAGES+=("text-generation") - fi - if [[ "$CORE" == "true" || "${{ steps.filter.outputs.image-generation }}" == "true" ]]; then - PACKAGES+=("image-generation") - fi - if [[ "$CORE" == "true" || "${{ steps.filter.outputs.video-generation }}" == "true" ]]; then - PACKAGES+=("video-generation") - fi - if [[ "$CORE" == "true" || "${{ steps.filter.outputs.speech-generation }}" == "true" ]]; then - PACKAGES+=("speech-generation") + # If first release or paths-filter was skipped, run all + if [[ "${{ steps.get-base.outputs.run-all }}" == "true" ]]; then + PACKAGES=("text-generation" "image-generation" "video-generation" "speech-generation") + else + CORE="${{ steps.filter.outputs.core }}" + if [[ "$CORE" == "true" || "${{ steps.filter.outputs.text-generation }}" == "true" ]]; then + PACKAGES+=("text-generation") + fi + if [[ "$CORE" == "true" || "${{ steps.filter.outputs.image-generation }}" == "true" ]]; then + PACKAGES+=("image-generation") + fi + if [[ "$CORE" == "true" || "${{ steps.filter.outputs.video-generation }}" == "true" ]]; then + PACKAGES+=("video-generation") + fi + if [[ "$CORE" == "true" || "${{ steps.filter.outputs.speech-generation }}" == "true" ]]; then + PACKAGES+=("speech-generation") + fi fi # Convert to JSON array