-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (63 loc) · 1.85 KB
/
consensus_to_pypi.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Upload Python Package to PyPI
on:
push:
branches:
- main
release:
types: [published]
jobs:
deploy_docs:
name: Deploy Documentation to GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build Documentation
run: |
cd docs
make html
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
publish_branch: gh-pages
extra_files: ".nojekyll"
build:
name: Build and upload package to PyPI
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Check out repository
uses: actions/checkout@v3
# Step 2: Set up Python environment
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x # Replace with your desired Python version
# Step 3: Install dependencies required for packaging
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
# Step 4: Build the package
- name: Build the package
run: python -m build
# Step 5: Upload the package to PyPI
- name: Upload to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} # PyPI API token stored as a secret in GitHub
run: |
python -m twine upload dist/*
# Optional Step: Clean up build artifacts
- name: Clean up
run: rm -rf dist