-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
f4d9ca6
commit 547e919
Showing
1 changed file
with
54 additions
and
17 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 |
---|---|---|
@@ -1,41 +1,78 @@ | ||
--- | ||
name: Upload Python Package | ||
name: Publish Python package to PyPI | ||
|
||
on: # yamllint disable-line rule:truthy | ||
release: | ||
types: ['published'] | ||
types: [published] | ||
|
||
permissions: | ||
contents: read | ||
|
||
env: | ||
POETRY_VERSION: '1.8.4' | ||
PYTHON_VERSION: '3.12' | ||
|
||
jobs: | ||
|
||
deploy: | ||
build: | ||
|
||
name: Build the package distribution | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/pyambit | ||
permissions: | ||
id-token: write | ||
|
||
steps: | ||
|
||
- name: Checkout the repository | ||
uses: actions/[email protected] | ||
with: | ||
ref: ${{ github.ref_name}} | ||
|
||
- name: Setup Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: '3.12' | ||
python-version: ${{ env.PYTHON_VERSION }} | ||
|
||
- name: Install Poetry | ||
uses: snok/[email protected] | ||
with: | ||
version: ${{ env.POETRY_VERSION }} | ||
virtualenvs-create: true | ||
virtualenvs-in-project: true | ||
|
||
- name: Perform package installation | ||
run: poetry install --no-interaction | ||
|
||
- name: Run tests | ||
run: poetry run pytest | ||
|
||
- name: Build the package distributions | ||
run: poetry build --no-interaction | ||
|
||
- uses: actions/[email protected] | ||
with: | ||
name: pyambit-dist | ||
path: dist | ||
if-no-files-found: error | ||
retention-days: 1 | ||
overwrite: true | ||
|
||
publish: | ||
|
||
name: Upload release to PyPI | ||
runs-on: ubuntu-latest | ||
needs: build | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/pyambit | ||
permissions: | ||
id-token: write | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install build | ||
steps: | ||
|
||
- name: Build package | ||
run: python -m build | ||
- name: Retrieve the package distributions | ||
uses: actions/[email protected] | ||
with: | ||
name: pyambit-dist | ||
path: dist | ||
|
||
- name: Publish package | ||
uses: pypa/gh-action-pypi-publish@v1.11.0 | ||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1.12.2 |