Skip to content

Commit f2cc03a

Browse files
authored
Merge pull request #94 from imedslab/prod-release-workflow
Add production release and build documentation workflow files
2 parents ee19c36 + 7f901e5 commit f2cc03a

File tree

2 files changed

+125
-0
lines changed

2 files changed

+125
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
validate-release:
9+
name: Validate Release Across Python Versions
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python-version: ["3.9", "3.10", "3.11", "3.12"]
14+
fail-fast: false
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
with:
20+
ref: ${{ github.event.release.tag_name }}
21+
22+
- name: Set up Python
23+
uses: actions/setup-python@v5
24+
with:
25+
python-version: ${{ matrix.python-version }}
26+
27+
- name: Update pip
28+
run: python -m pip install --upgrade pip
29+
30+
- name: Install wheel and build tools
31+
run: python -m pip install --upgrade wheel build
32+
33+
- name: Install project dependencies
34+
run: |
35+
pip install -r ci/requirements.txt
36+
pip install .
37+
38+
- name: Run tests
39+
run: pytest tests --cov solt --cov-report term-missing -v
40+
41+
- name: Check code formatting
42+
run: black --config=black.toml --check .
43+
44+
- name: Run flake8 linter
45+
run: flake8
46+
47+
build-and-publish:
48+
name: Build and Publish to PyPI
49+
runs-on: ubuntu-latest
50+
needs: validate-release
51+
environment:
52+
name: pypi
53+
url: https://pypi.org/project/solt/
54+
55+
steps:
56+
- name: Checkout code
57+
uses: actions/checkout@v4
58+
with:
59+
ref: ${{ github.event.release.tag_name }}
60+
61+
- name: Set up Python
62+
uses: actions/setup-python@v5
63+
with:
64+
python-version: "3.11"
65+
66+
- name: Install build tools
67+
run: |
68+
python -m pip install --upgrade pip
69+
python -m pip install --upgrade wheel build twine
70+
71+
- name: Build distributions
72+
run: |
73+
python -m build
74+
75+
- name: Validate built packages with twine
76+
run: |
77+
twine check dist/*
78+
79+
- name: Publish to PyPI
80+
uses: pypa/gh-action-pypi-publish@release/v1
81+
with:
82+
password: ${{ secrets.PYPI_API_TOKEN }}
83+
packages-dir: dist/
84+
verbose: true

.github/workflows/update-docs.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# .github/workflows/update-docs.yml
2+
3+
name: Build and Deploy Documentation
4+
5+
on:
6+
push:
7+
branches:
8+
- master
9+
paths:
10+
- 'doc/**'
11+
12+
jobs:
13+
build-deploy-docs:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.x'
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip
28+
pip install sphinx
29+
pip install .
30+
31+
- name: Build documentation
32+
working-directory: doc
33+
run: make html
34+
35+
- name: Deploy to GitHub Pages
36+
uses: peaceiris/actions-gh-pages@v4
37+
with:
38+
github_token: ${{ secrets.GITHUB_TOKEN }}
39+
publish_dir: ./doc/_build/html
40+
publish_branch: gh-pages
41+
force_orphan: true

0 commit comments

Comments
 (0)