-
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.
ci:build and publish at pypi and test-pypi (#15)
- Loading branch information
Showing
3 changed files
with
122 additions
and
40 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,59 @@ | ||
--- | ||
name: Publish Python Package | ||
|
||
on: | ||
release: | ||
types: [published] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build-module: | ||
name: Build and publish Python 🐍 distributions 📦 to PyPI | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install Poetry | ||
run: | | ||
pip install poetry | ||
poetry self add "poetry-dynamic-versioning[plugin]" | ||
- name: Build source and wheel archives | ||
run: poetry build | ||
|
||
- name: Upload distributions | ||
# https:/actions/upload-artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: release-dists | ||
path: dist/ | ||
|
||
pypi-publish: | ||
name: Upload release to PyPI | ||
needs: | ||
- build-module | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/modos_schema | ||
permissions: | ||
id-token: write | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
steps: | ||
- name: Retrieve release distributions | ||
# https:/actions/download-artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: release-dists | ||
path: dist/ | ||
- name: Publish package distributions to PyPI | ||
# https:/pypa/gh-action-pypi-publish | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
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 @@ | ||
# Workflow following resources at: | ||
# - https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-pypi | ||
# - https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives | ||
# Jobs are split to prevent unneccessary priviledge elevation through write permissions during building. | ||
|
||
name: Build and publish on test-pypi | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
test-build: | ||
name: Build python wheels | ||
runs-on: ubuntu-latest | ||
steps: | ||
# https:/actions/checkout | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
# https:/actions/setup-python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Install Poetry | ||
run: | | ||
pip install poetry | ||
- name: Build source and wheel archives | ||
run: poetry build | ||
|
||
- name: Upload distributions | ||
# https:/actions/upload-artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: test-dists | ||
path: dist/ | ||
|
||
pypi-test-publish: | ||
name: Upload release to PyPI Test | ||
needs: | ||
- test-build | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: test-pypi | ||
url: https://test.pypi.org/p/modos_schema | ||
permissions: | ||
id-token: write | ||
# IMPORTANT: this permission is mandatory for trusted publishing | ||
steps: | ||
- name: Retrieve release distributions | ||
# https:/actions/download-artifact | ||
uses: actions/[email protected] | ||
with: | ||
name: test-dists | ||
path: dist/ | ||
- name: Publish package distributions to TestPyPI | ||
# https:/pypa/gh-action-pypi-publish | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ |