From 7d61f93ac161c1f545e427a8988ca54d8f4af830 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Sat, 31 May 2025 11:55:34 +0200 Subject: [PATCH] feat: add check action --- .forgejo/workflows/check-version-exists.yaml | 34 ------------- .forgejo/workflows/pycairo.yaml | 49 ------------------- action.yaml | 32 ++++++++++++ .../check_version_exists.py => check.py | 0 4 files changed, 32 insertions(+), 83 deletions(-) delete mode 100644 .forgejo/workflows/check-version-exists.yaml delete mode 100644 .forgejo/workflows/pycairo.yaml create mode 100644 action.yaml rename .forgejo/workflows/check_version_exists.py => check.py (100%) 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/pycairo.yaml b/.forgejo/workflows/pycairo.yaml deleted file mode 100644 index 6e7631c..0000000 --- a/.forgejo/workflows/pycairo.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: Build pycairo - -on: - workflow_dispatch: - schedule: - - cron: "0 10 * * 0" - -env: - REPOSITORY_URL: https://cmwedding-bot:${{ secrets.FORGEJO_TOKEN }}@git.weddingfactory.eu/api/packages/cmwedding/pypi - -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" - - build: - name: Build wheels on ${{ matrix.os }} - - needs: check-version-exists - if: needs.check-version-exists.outputs.version != "" - - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - - steps: - - run: git clone --depth=1 https://github.com/pygobject/pycairo --branch ${{ needs.check-version-exists.outputs.version }} . - - - name: Build wheels - uses: https://github.com/pypa/cibuildwheel@v2.23.3 - env: - CIBW_BEFORE_ALL_LINUX: "dnf install -y cairo-devel" - CIBW_BUILD: "cp31{0..3}-manylinux_{x86_64,aarch64}" - CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 - CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 - - - name: Publish package distributions to Forgejo - run: | - pip3 install twine - python3 -m twine upload ./wheelhouse/* - env: - TWINE_REPOSITORY_URL: ${{ env.REPOSITORY_URL }} - TWINE_NON_INTERACTIVE: 1 - diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..6e12950 --- /dev/null +++ b/action.yaml @@ -0,0 +1,32 @@ +name: "check-latest-version-exists action" +description: "Check whether the latest github release/tag of a pypi package exists on a registry. If not, return the latest version" + +inputs: + github-repository: + description: "The package's Github repository name (owner/repo)" + required: true + pypi-package: + description: "The name of the package" + required: true + pypi-base-url: + description: "The pypi registry URL" + required: true + +outputs: + version: + description: "The version of the package" + value: ${{ steps.check.outputs.version }} + +runs: + using: "composite" + steps: + - id: check + shell: bash + run: | + pip3 install requests + exec python3 $GITHUB_ACTION_PATH/check.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/check.py similarity index 100% rename from .forgejo/workflows/check_version_exists.py rename to check.py