diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c8de9d0..4512526 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -65,6 +65,31 @@ jobs: name: sphgeom-sdist path: dist/* + check-changes: + outputs: + skip: ${{ steps.check.outputs.skip }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Check if weekly changed + id: check + run: | + prev_tag=$(git tag -l 'w.*' | sort | tail -2 | head -1) + prev_sha=$(git rev-list -1 "$prev_tag") + echo "Previous tag ${prev_tag} (${prev_sha})" + current_tag=${GITHUB_REF#refs/tags/} + current_sha=$(git rev-list -1 "$current_tag") + echo "Current tag ${current_tag} (${current_sha})" + if [ "$current_sha" = "$prev_sha" ]; then + echo "Hashes are identical - Skipping upload" + echo "skip=true" >> "$GITHUB_ENV" + else + echo "Hashes differ - Enable upload" + echo "skip=false" >> "$GITHUB_ENV" + fi + pypi_wheel_build: strategy: matrix: @@ -110,7 +135,8 @@ jobs: path: dist/* pipy_upload: - needs: [pypi_sdist_build, pypi_wheel_build] + needs: [pypi_sdist_build, pypi_wheel_build, check-changes] + if: "!startsWith(github.ref, 'refs/tags/w.') || needs.check-changes.outputs.skip == 'false'" runs-on: ubuntu-latest steps: - uses: actions/download-artifact@v4