diff --git a/.github/workflows/python-tests.yml b/.github/workflows/python-tests.yml index 2b42e86..0558fec 100644 --- a/.github/workflows/python-tests.yml +++ b/.github/workflows/python-tests.yml @@ -60,8 +60,7 @@ jobs: - name: Build PyPi package run: uv run maturin build --release --out dist - name: Publish PyPi package - # TODO: Remove || true - run: uv run maturin publish --username __token__ --password ${{ secrets.PYPI_TOKEN }} || true + run: uv run maturin publish --skip-existing --username __token__ --password ${{ secrets.PYPI_TOKEN }} linux: runs-on: ${{ matrix.platform.runner }} needs: publish diff --git a/.github/workflows/rust-tests.yml b/.github/workflows/rust-tests.yml index f3cfb92..8edbbb1 100644 --- a/.github/workflows/rust-tests.yml +++ b/.github/workflows/rust-tests.yml @@ -51,4 +51,10 @@ jobs: uses: actions-rust-lang/setup-rust-toolchain@v1 - name: Publish to crates.io - run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} + run: | + VERSION=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[0].version') + if cargo search cloudcheck --limit 1 | head -1 | grep -q "$VERSION"; then + echo "Version $VERSION already exists on crates.io, skipping publish" + else + cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} + fi diff --git a/cloudcheck_update/cli.py b/cloudcheck_update/cli.py index e2d7708..f4f3b3a 100644 --- a/cloudcheck_update/cli.py +++ b/cloudcheck_update/cli.py @@ -1,12 +1,20 @@ +import os import sys from cloudcheck_update import update def main(): + threshold = int(os.environ.get("ERROR_THRESHOLD", 10)) errors = update() for error in errors: print(error) - return 1 if errors else 0 + error_count = len(errors) + if error_count > threshold: + print(f"Error count ({error_count}) exceeds threshold ({threshold})") + return 1 + elif error_count > 0: + print(f"Error count ({error_count}) within threshold ({threshold})") + return 0 if __name__ == "__main__":