debug tagging #111
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: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI | |
on: | |
push: | |
branches: | |
- pyproject.toml # test branch for testing the workflow | |
tags: | |
- v* # Push tags to trigger the workflow | |
workflow_dispatch: | |
inputs: | |
test: | |
description: "Push to TestPyPI not PyPI" | |
default: true | |
type: boolean | |
jobs: | |
check-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Check if tag is present | |
run: | | |
if [ -z "$GITHUB_REF" ]; then | |
echo "No tag found" | |
exit 1 | |
fi | |
echo "Tag found: $GITHUB_REF" | |
Build-and-publish-to-Test-PyPI: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Set up Poetry 📦 | |
uses: JRubics/[email protected] | |
with: | |
pypi_token: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
plugins: "poetry-dynamic-versioning" | |
repository_name: "scraibe" | |
repository_url: "https://test.pypi.org/legacy/" | |
test-install: | |
name: Test Installation from TestPyPI | |
needs: Build-and-publish-to-Test-PyPI | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install package | |
run: | | |
python3 -m pip install setuptools | |
python3 -m pip install --index-url https://test.pypi.org/simple/ scraibe | |
# publish-to-pypi: | |
# name: Conditional Publish to PyPI or Dev Repository | |
# needs: [build, test-install] | |
# runs-on: ubuntu-latest | |
# environment: | |
# name: pypi | |
# url: env.PyPI_URL | |
# permissions: | |
# id-token: write | |
# steps: | |
# - name: Download all the dists | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: python-package-distributions | |
# path: dist/ | |
# - name: Publish distribution 📦 to PyPI or Dev Repository | |
# uses: pypa/gh-action-pypi-publish@release/v1 | |
# with: | |
# repository-url: ${{ github.ref == 'refs/heads/main' && 'env.PyPI_URL' || ' env.PyPI_DEV_URL' }} | |
# password: ${{ secrets.PYPI_API_TOKEN}} |