Skip to content

Commit

Permalink
feat: separate workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
GoliathLabs committed Jan 24, 2025
1 parent 5947154 commit 504b4db
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 16 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/pr-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Test Pull Requests

on:
pull_request:

jobs:
test:
name: Test Pull Requests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Display Python version
run: python -c "import sys; print(sys.version)"

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel build
- name: Build distributions
run: python -m build --sdist --wheel --outdir dist/

- name: Test build
run: |
python -m pip install dist/*.whl
# Optional: Add commands to test the package functionality
30 changes: 14 additions & 16 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
name: Publish Python Distributions to PyPI and TestPyPI
name: Publish Tag Releases to PyPI

on: push
on:
push:
tags:
- "v*"

jobs:
build-and-publish:
name: Build and Publish Python Distributions
publish:
name: Build and Publish to PyPI
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: "3.11"

- name: Display Python version
run: python -c "import sys; print(sys.version)"

Expand All @@ -30,15 +31,12 @@ jobs:
- name: Build distributions
run: python -m build --sdist --wheel --outdir dist/

- name: Publish to TestPyPI
if: contains(github.ref, 'refs/tags') && github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@master
- name: Publish package distributions to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/

- name: Publish to PyPI
if: contains(github.ref, 'refs/tags') && github.event_name == 'push'
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}

0 comments on commit 504b4db

Please sign in to comment.