feat: move action to own branch
This commit is contained in:
parent
ee1dcf4a21
commit
ed6097b3fe
3 changed files with 11 additions and 76 deletions
|
|
@ -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}}
|
||||
|
||||
|
|
@ -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"<a href=\".+\">{package}-{version}-.+</a>", 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()
|
||||
|
||||
|
|
@ -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 }}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue