diff --git a/.forgejo/workflows/check-version-exists.yaml b/.forgejo/workflows/check-version-exists.yaml deleted file mode 100644 index e2baaa4..0000000 --- a/.forgejo/workflows/check-version-exists.yaml +++ /dev/null @@ -1,34 +0,0 @@ -on: - workflow_call: - inputs: - github-repository: - required: true - type: string - pypi-package: - required: true - type: string - pypi-base-url: - required: true - type: string - outputs: - version: ${{ jobs.check-version-exists.outputs.version }} - -jobs: - check-version-exists: - runs-on: ubuntu-latest - - outputs: - version: ${{ steps.check.outputs.version }} - - steps: - - uses: actions/checkout@v4 - - - id: check - run: | - pip3 install requests - exec python3 .forgejo/workflows/check_version_exists.py >> $GITHUB_OUTPUT - env: - REPOSITORY: ${{ inputs.github-repository }} - PACKAGE: ${{ inputs.pypi-package}} - BASE_URL: ${{ inputs.pypi-base-url}} - diff --git a/.forgejo/workflows/check_version_exists.py b/.forgejo/workflows/check_version_exists.py deleted file mode 100644 index d6efa40..0000000 --- a/.forgejo/workflows/check_version_exists.py +++ /dev/null @@ -1,37 +0,0 @@ -#/usr/bin/env python3 - -import os -import re -import sys -import requests - - -def get_github_version(repository: str) -> str: - res = requests.get(f"https://api.github.com/repos/{repository}/releases/latest").json() - return res["tag_name"].removeprefix("v") - - -def does_pypi_version_exist(base_url: str, package: str, version: str) -> bool: - base_url = base_url.removesuffix("/") - version = version.replace(".", "\\.") - - body = requests.get(f"{base_url}/simple/{package}").text - return len(re.findall(rf"{package}-{version}-.+", body, re.MULTILINE)) > 0 - - -def main(): - repository = os.environ["REPOSITORY"] - package = os.environ["PACKAGE"] - base_url = os.environ["FORGEJO_URL"] - - version = get_github_version(repository) - - if does_pypi_version_exist(base_url, package, version): - sys.exit(0) - - print(f"version=v{version}") - - -if __name__ == "__main__": - main() - diff --git a/.forgejo/workflows/pycairo.yaml b/.forgejo/workflows/pycairo.yaml index 6e7631c..1dd38c8 100644 --- a/.forgejo/workflows/pycairo.yaml +++ b/.forgejo/workflows/pycairo.yaml @@ -11,11 +11,17 @@ env: jobs: check-version-exists: runs-on: ubuntu-latest - uses: ./.forgejo/workflows/check-version-exists.yaml - with: - pypi-base-url: ${{ env.REPOSITORY_URL }} - pypi-package: pycairo - github-repository: "pygobject/pycairo" + + outputs: + version: ${{ steps.check.outputs.version }} + + steps: + - id: check + uses: https://git.weddingfactory.eu/wheels@check-action + with: + pypi-base-url: ${{ env.REPOSITORY_URL }} + pypi-package: pycairo + github-repository: "pygobject/pycairo" build: name: Build wheels on ${{ matrix.os }}