Skip to content

Commit ecf88a9

Browse files
committed
feat: allow custom url for wheel file
1 parent 21fed42 commit ecf88a9

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

.github/actions.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ def transform_github_url(input_url):
5757
return raw_url
5858

5959

60-
def register(pkg_name, version, author, short_desc, homepage):
61-
link = f'git+{homepage}@{version}'
60+
def register(pkg_name, version, author, short_desc, homepage, wheel_url):
61+
link = wheel_url if wheel_url else f'git+{homepage}@{version}'
6262
long_desc = transform_github_url(homepage)
6363
# Read our index first
6464
with open(INDEX_FILE) as html_file:
@@ -103,7 +103,7 @@ def register(pkg_name, version, author, short_desc, homepage):
103103
f.write(template)
104104

105105

106-
def update(pkg_name, version):
106+
def update(pkg_name, version, wheel_url):
107107
# Read our index first
108108
with open(INDEX_FILE) as html_file:
109109
soup = BeautifulSoup(html_file, "html.parser")
@@ -147,7 +147,7 @@ def update(pkg_name, version):
147147
main_version_span = soup.find('span', id='latest-main-version')
148148
main_version_span.string = version
149149
anchor.string = norm_version
150-
anchor['href'] = f"git+{link}@{version}#egg={norm_pkg_name}-{norm_version}"
150+
anchor['href'] = wheel_url if wheel_url else f"git+{link}@{version}#egg={norm_pkg_name}-{norm_version}"
151151

152152
# Add it to our index
153153
original_div.insert_after(new_div)
@@ -191,6 +191,7 @@ def main():
191191
author=os.environ["PKG_AUTHOR"],
192192
short_desc=os.environ["PKG_SHORT_DESC"],
193193
homepage=os.environ["PKG_HOMEPAGE"],
194+
wheel_url=os.environ["PKG_WHEEL_URL"]
194195
)
195196
elif action == "DELETE":
196197
delete(
@@ -199,7 +200,8 @@ def main():
199200
elif action == "UPDATE":
200201
update(
201202
pkg_name=os.environ["PKG_NAME"],
202-
version=os.environ["PKG_VERSION"]
203+
version=os.environ["PKG_VERSION"],
204+
wheel_url=os.environ["PKG_WHEEL_URL"]
203205
)
204206

205207

.github/workflows/register.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ on:
2323
description: 'Homepage of the package (link to the github repository)'
2424
required: true
2525
type: string
26+
wheel_url:
27+
description: 'Custom url to download wheel build (if not supple, will default to git clone)'
28+
required: false
29+
type: string
2630

2731
jobs:
2832
update:
@@ -45,6 +49,7 @@ jobs:
4549
PKG_AUTHOR: ${{ inputs.author }}
4650
PKG_SHORT_DESC: ${{ inputs.short_desc }}
4751
PKG_HOMEPAGE: ${{ inputs.homepage }}
52+
PKG_WHEEL_URL: ${{ inputs.wheel_url }}
4853
run: |
4954
pip install beautifulsoup4
5055
python .github/actions.py

.github/workflows/update.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
description: New version of the package (tag name)
1212
required: true
1313
type: string
14+
wheel_url:
15+
description: 'Custom url to download wheel build (if not supple, will default to git clone)'
16+
required: false
17+
type: string
1418

1519
jobs:
1620
update:
@@ -30,6 +34,7 @@ jobs:
3034
PKG_ACTION: UPDATE
3135
PKG_NAME: ${{ inputs.package_name }}
3236
PKG_VERSION: ${{ inputs.version }}
37+
PKG_WHEEL_URL: ${{ inputs.wheel_url }}
3338
run: |
3439
pip install beautifulsoup4
3540
python .github/actions.py

0 commit comments

Comments
 (0)