Skip to content

Commit

Permalink
chore: add release workflow (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
cachho authored Aug 24, 2023
1 parent f0f5c34 commit abf99ce
Showing 1 changed file with 28 additions and 16 deletions.
44 changes: 28 additions & 16 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,36 @@
name: cd
name: Publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI

on:
release:
types:
- published

permissions:
id-token: write
contents: read
types: [published] # This will trigger the workflow when you create a new release

jobs:
publish_to_pypi:
name: publish to pypi on new release
build-n-publish:
name: Build and publish Python 🐍 distributions πŸ“¦ to PyPI and TestPyPI
runs-on: ubuntu-latest
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v3
- uses: JRubics/poetry-publish@v1.16
name: Build and publish to PyPI
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
pypi_token: ${{ secrets.PYPI_TOKEN }}
ignore_dev_requirements: "yes"
repository_url: https://upload.pypi.org/legacy/
repository_name: embedchain
python-version: 3.10

- name: Install pep517
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

0 comments on commit abf99ce

Please sign in to comment.