And I'm feeling good! #1
Workflow file for this run
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: Upload Python Package to PyPI when a Release is Created | |
on: | |
release: | |
types: [created] | |
jobs: | |
pypi-publish: | |
name: Publish release to PyPI | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/dataset-viber | |
permissions: | |
id-token: write | |
steps: | |
- name: Checkout Code 🛎 | |
uses: actions/checkout@v4 | |
- name: Setup PDM | |
uses: pdm-project/setup-pdm@v4 | |
with: | |
cache: true | |
python-version-file: pyproject.toml | |
cache-dependency-path: pdm.lock | |
- name: Read package info | |
run: | | |
PACKAGE_VERSION=$(pdm show --version) | |
PACKAGE_NAME=$(pdm show --name) | |
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV | |
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV | |
echo "$PACKAGE_NAME==$PACKAGE_VERSION" | |
- name: Publish Package to PyPI test environment 🥪 | |
run: pdm publish --no-build --repository testpypi | |
continue-on-error: true | |
- name: Test Installing 🍿 | |
continue-on-error: true | |
run: | | |
pip3 install --index-url https://test.pypi.org/simple --no-deps $PACKAGE_NAME==$PACKAGE_VERSION | |
- name: Publish Package to PyPI 🥩 | |
if: github.ref == 'refs/heads/main' | |
run: pdm publish --no-build |