chore: add release workflow (#397)
This commit is contained in:
44
.github/workflows/cd.yml
vendored
44
.github/workflows/cd.yml
vendored
@@ -1,24 +1,36 @@
|
|||||||
name: cd
|
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types:
|
types: [published] # This will trigger the workflow when you create a new release
|
||||||
- published
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
id-token: write
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish_to_pypi:
|
build-n-publish:
|
||||||
name: publish to pypi on new release
|
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
# IMPORTANT: this permission is mandatory for trusted publishing
|
||||||
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v2
|
||||||
- uses: JRubics/poetry-publish@v1.16
|
|
||||||
name: Build and publish to PyPI
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
with:
|
with:
|
||||||
pypi_token: ${{ secrets.PYPI_TOKEN }}
|
python-version: 3.10
|
||||||
ignore_dev_requirements: "yes"
|
|
||||||
repository_url: https://upload.pypi.org/legacy/
|
- name: Install pep517
|
||||||
repository_name: embedchain
|
run: |
|
||||||
|
python -m pip install pep517 --user
|
||||||
|
|
||||||
|
- name: Build a binary wheel and a source tarball
|
||||||
|
run: python -m pep517.build .
|
||||||
|
|
||||||
|
- name: Publish distribution 📦 to Test PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
with:
|
||||||
|
repository_url: https://test.pypi.org/legacy/
|
||||||
|
|
||||||
|
- name: Publish distribution 📦 to PyPI
|
||||||
|
if: startsWith(github.ref, 'refs/tags')
|
||||||
|
uses: pypa/gh-action-pypi-publish@release/v1
|
||||||
|
|||||||
Reference in New Issue
Block a user