chore: release v0.1.7 #18
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
name: Publish Python 🐍 Distribution 📦 to PyPI and TestPyPI | |
on: | |
push | |
jobs: | |
build: | |
name: 📦 Build Distribution Packages | |
runs-on: ubuntu-latest | |
steps: | |
- name: 📥 Checkout Repository | |
uses: actions/checkout@v4 | |
- name: 🐍 Set Up Python Environment | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: 📦 Install Poetry | |
uses: abatilo/actions-poetry@v3 | |
with: | |
poetry-version: "1.8.4" | |
- name: ⚙️ Install Build Tools | |
run: >- | |
python3 -m pip install build --user | |
- name: 🛠️ Build Source and Binary Distributions | |
run: poetry build | |
- name: 📤 Upload Distribution Artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
publish-to-pypi: | |
name: 🚀 Publish Python Distribution to PyPI | |
if: startsWith(github.ref, 'refs/tags/') # Only publish to PyPI on tag pushes | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/embs | |
permissions: | |
id-token: write # Mandatory for trusted publishing | |
steps: | |
- name: 📦 Download Distribution Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: 🌐 Upload to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
github-release: | |
name: 🔏 Sign and Release Python Distribution on GitHub | |
needs: | |
- publish-to-pypi | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # Mandatory for making GitHub Releases | |
id-token: write # Mandatory for Sigstore | |
steps: | |
- name: 📦 Download Distribution Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: 🔐 Sign Artifacts with Sigstore | |
uses: sigstore/[email protected] | |
with: | |
inputs: >- | |
./dist/*.tar.gz | |
./dist/*.whl | |
- name: 📝 Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: >- | |
gh release create | |
'${{ github.ref_name }}' | |
--repo '${{ github.repository }}' | |
--notes "" | |
- name: 📤 Upload Signed Artifacts to GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
run: >- | |
gh release upload | |
'${{ github.ref_name }}' dist/** | |
--repo '${{ github.repository }}' | |
publish-to-testpypi: | |
name: 🚀 Publish Python Distribution to TestPyPI | |
if: startsWith(github.ref, 'refs/tags/') # Only publish to PyPI on tag pushes | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/embs | |
permissions: | |
id-token: write # Mandatory for trusted publishing | |
steps: | |
- name: 📦 Download Distribution Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: 🌐 Upload to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ |