-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
112 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
name: Upload Python Package to PyPI | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
build: | ||
name: Build and deploy | ||
environment: production | ||
permissions: | ||
id-token: write | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Set environment variables | ||
id: set_env_variables | ||
run: | | ||
echo "PYTHONPATH=." >> "$GITHUB_ENV" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
pip install -r requirements.txt | ||
- name: Test with pytest | ||
run: | | ||
pip install pytest | ||
pytest test/ --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml | ||
- name: Extract tag name | ||
id: tag | ||
run: echo "PKG_VERSION=$(echo $GITHUB_REF | cut -d / -f 3)" >> "$GITHUB_OUTPUT" | ||
|
||
- name: Update version in pyproject.toml | ||
run: >- | ||
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.PKG_VERSION }}/g" pyproject.toml | ||
- name: Build package | ||
run: python -m build | ||
|
||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-artifacts | ||
path: | | ||
dist/ | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: ${{ vars.PYPI_URL }} | ||
password: ${{ secrets.PYPI_API_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
|
||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
build: | ||
name: Build Package | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Set environment variables | ||
id: set_env_variables | ||
run: | | ||
echo "PYTHONPATH=." >> "$GITHUB_ENV" | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
pip install -r requirements.txt | ||
- name: Test with pytest | ||
run: | | ||
pip install pytest | ||
pytest test/ --doctest-modules --junitxml=junit/test-results-${{ matrix.python-version }}.xml | ||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: test-results-${{ matrix.python-version }} | ||
path: | | ||
junit/test-results-${{ matrix.python-version }}.xml | ||
if: ${{ always() }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,3 +3,4 @@ dist/ | |
*.egg-info/ | ||
.coverage | ||
venv/ | ||
junit/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters