Skip to content

Commit e7ed223

Browse files
committed
Add initial implementation of Python Package Index Generator
- Created action.yml to define a GitHub Action for generating an index.html file for a private Python package repository. - Added generate-index.py script to handle S3 bucket name input. - Updated README.md with a brief description of the package functionality. - Established CI workflow in ci.yml for testing and publishing the package to PyPI.
0 parents  commit e7ed223

File tree

4 files changed

+103
-0
lines changed

4 files changed

+103
-0
lines changed

.github/workflows/ci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: ["3.8", "3.9", "3.10", "3.11"]
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install pytest
28+
pip install -e .
29+
30+
- name: Run tests
31+
run: |
32+
pytest
33+
34+
build-and-publish:
35+
needs: test
36+
runs-on: ubuntu-latest
37+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
38+
39+
steps:
40+
- uses: actions/checkout@v3
41+
42+
- name: Set up Python
43+
uses: actions/setup-python@v4
44+
with:
45+
python-version: "3.11"
46+
47+
- name: Install build dependencies
48+
run: |
49+
python -m pip install --upgrade pip
50+
pip install build twine
51+
52+
- name: Build package
53+
run: python -m build
54+
55+
- name: Publish to PyPI
56+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
57+
env:
58+
TWINE_USERNAME: __token__
59+
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
60+
run: |
61+
twine upload dist/*

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
# This package is used to generate the index.html file for the python package index.

action.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Python Package Index Generator"
2+
description: "Generates an index.html file for hosting a private Python package repository"
3+
author: "EarningsCall"
4+
5+
inputs:
6+
s3_bucket_name:
7+
description: "S3 bucket name"
8+
required: true
9+
default: "EarningsCall"
10+
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Set up Python
15+
uses: actions/setup-python@v4
16+
with:
17+
python-version: "3.11"
18+
19+
- name: Install dependencies
20+
shell: bash
21+
run: |
22+
python -m pip install boto3 botocore
23+
24+
- name: Generate Index
25+
shell: bash
26+
run: |
27+
python ${{ github.action_path }}/generat-index.py --s3-bucket-name ${{ inputs.s3_bucket_name }}
28+
29+
branding:
30+
icon: "package"
31+
color: "blue"

generate-index.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import argparse
2+
3+
4+
parser = argparse.ArgumentParser(description='')
5+
parser.add_argument("--s3-bucket-name", type=str, help="S3 bucket name")
6+
7+
8+
print("Hello World!")
9+

0 commit comments

Comments
 (0)