-
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.
https://johnfraney.ca/blog/how-to-publish-a-python-package-with-poetry-and-github-actions/ https://github.com/marketplace/actions/pypi-publish
- Loading branch information
1 parent
4105b34
commit 7a90ffc
Showing
1 changed file
with
41 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,24 +1,48 @@ | ||
name: Python package | ||
name: Publish Test PyPI on Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*.*" | ||
- 'v*.*.*.*' | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
test-pypi-publish: | ||
name: Upload release to Test PyPI | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: testpypi | ||
url: https://test.pypi.org/project/jsonschema-fill-default/ | ||
permissions: | ||
id-token: write | ||
steps: | ||
- run: echo "Job automatically triggered by a tagged ${{ github.event_name }} event." | ||
- uses: actions/checkout@v3 | ||
- name: Build and publish to pypi | ||
uses: JRubics/[email protected] | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v5 | ||
with: | ||
pypi_token: ${{ secrets.TESTPYPI }} | ||
repository_name: "jsonschema-fill-default" | ||
repository_url: "https://test.pypi.org/projects/jsonschema-fill-default" | ||
|
||
#steps: | ||
#- uses: actions/checkout@v3 | ||
#- name: Build and publish to pypi | ||
# uses: JRubics/[email protected] | ||
# with: | ||
# pypi_token: ${{ secrets.PYPI_TOKEN }} | ||
python-version: "3.9" | ||
|
||
- name: Install Poetry | ||
run: | | ||
curl -sSL https://install.python-poetry.org | python - -y | ||
- name: Update PATH | ||
run: echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
|
||
- name: Update Poetry configuration | ||
run: poetry config virtualenvs.create false | ||
|
||
- name: Install dependencies | ||
run: poetry install --sync --no-interaction | ||
|
||
- name: Package project | ||
run: poetry build | ||
|
||
- name: Publish package distributions to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ |