-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add workflows for automated package upload
Added workflows that automatically publish the package to the PyPI host.
- Loading branch information
Showing
3 changed files
with
118 additions
and
0 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,34 @@ | ||
name: PyPI release | ||
|
||
on: | ||
workflow_run: | ||
workflows: [Update package version] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
|
||
deploy-package: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: python -m pip install --upgrade pip twine setuptools wheel six requests build urllib3 | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Build package | ||
run: python -m build | ||
|
||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | ||
with: | ||
user: __token__ | ||
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,47 @@ | ||
--- | ||
|
||
name: Python Test Execution | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python 3.10 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: "3.10" | ||
|
||
- name: Install and activate virtual environment | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install virtualenv | ||
python -m virtualenv .venv | ||
source .venv/bin/activate | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install pytest | ||
if [ -f requirements.txt ]; then | ||
python -m pip install -r requirements.txt | ||
fi | ||
- name: Install package from local source | ||
run: python -m pip install -e . | ||
|
||
- name: Test with PyTest | ||
run: python -m pytest tests/ |
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,37 @@ | ||
name: Update package version | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
|
||
update-package-version: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.9' | ||
|
||
- uses: actions/checkout@v3 | ||
|
||
- name: Update pyproject.toml version | ||
run: | | ||
git clone https://gist.github.com/a66c601b7ebab8dc9370348697e540d1.git | ||
version=${{github.ref}} | ||
python3 a66c601b7ebab8dc9370348697e540d1/pytoml-version-updater.py ${version#refs/tags/v} | ||
- name: Config git | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Paulo Sánchez" | ||
- name: Commit and push pyproject.toml modifications | ||
run: | | ||
version=${{github.ref}} | ||
git commit pyproject.toml -m "Update version to ${version#refs/tags/v}" | ||
git push origin HEAD:main |