diff --git a/.github/workflows/generate-and-deploy.yml b/.github/workflows/generate-and-deploy.yml
index 2eded9f..e90e59a 100644
--- a/.github/workflows/generate-and-deploy.yml
+++ b/.github/workflows/generate-and-deploy.yml
@@ -18,7 +18,7 @@ jobs:
run: |
cp -a _skeleton/ _generate/
pip3 install -U PyGithub
- ./generate.py _generate/pre/index.html
+ ./generate.py _generate/
- name: Deploy 🚀
uses: peaceiris/actions-gh-pages@v3
diff --git a/_skeleton/aarch64/.gitignore b/_skeleton/aarch64/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/generate.py b/generate.py
index e8f42fe..bab680f 100755
--- a/generate.py
+++ b/generate.py
@@ -10,13 +10,13 @@
-CuPy: Pre-Release Wheels
+CuPy: {title}
-CuPy: Pre-Release Wheels
+CuPy: {title}
-$ pip install 'cupy-cudaXXX==X.Y.Z' -f https://pip.cupy.dev/pre
+$ {command}
'''
@@ -26,26 +26,70 @@
'''
-def main(out_file):
- token = os.environ['GITHUB_TOKEN']
- repo = github.Github(token).get_repo('cupy/cupy')
+class Generator:
+ def __init__(self):
+ self._lines = None
- lines = [_header]
- for release in repo.get_releases():
- if not release.prerelease:
- print(f'Skipping stable release: {release.title}')
- continue
- lines.append(f'{release.title}
')
+ def process_release(self, release):
+ self._lines.append(f'{release.title}
')
count = 0
for asset in release.get_assets():
+ self.process_asset(asset)
count += 1
- url = asset.browser_download_url
- lines.append(f'{os.path.basename(url)}
')
print(f'Processed: {release.title} ({count} assets)')
- lines.append(_footer)
- with open(out_file, 'w') as f:
- f.write('\n'.join(lines))
+ def process_asset(self, asset):
+ url = asset.browser_download_url
+ self._lines.append(f'{os.path.basename(url)}
')
+
+ def generate(self, repo, out_file, *, title, command):
+ print(f'=== Generating {out_file}')
+ self._lines = [
+ _header.format(title=title, command=command)
+ ]
+ for release in repo.get_releases():
+ self.process_release(release)
+ self._lines.append(_footer)
+ output = '\n'.join(self._lines)
+ with open(out_file, 'w') as f:
+ f.write(output)
+
+
+class PreReleaseGenerator(Generator):
+ def process_release(self, release):
+ if not release.prerelease:
+ print(f'Skipping stable release: {release.title}')
+ return
+ super().process_release(release)
+
+
+class AArch64Generator(Generator):
+ def process_asset(self, asset):
+ if not 'aarch64' in asset.name:
+ print(f'Skipping non-aarch64 asset: {asset.name}')
+ return
+ super().process_asset(asset)
+
+
+def main(out_dir):
+ token = os.environ['GITHUB_TOKEN']
+ repo = github.Github(token).get_repo('cupy/cupy')
+
+ gen = PreReleaseGenerator()
+ output = gen.generate(
+ repo,
+ f'{out_dir}/pre/index.html',
+ title='Pre-Release Wheels',
+ command='pip install --pre cupy-cudaXXX -f https://pip.cupy.dev/pre',
+ )
+
+ gen = AArch64Generator()
+ output = gen.generate(
+ repo,
+ f'{out_dir}/aarch64/index.html',
+ title='Arm Wheels',
+ command='pip install cupy-cudaXXX -f https://pip.cupy.dev/aarch64',
+ )
if __name__ == '__main__':