Release a new version #7
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: Release a new version | |
on: workflow_dispatch | |
jobs: | |
release_to_pypi: | |
name: Release distribution to PyPi | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11.x' | |
architecture: 'x64' | |
- name: Install Poetry and prepare version | |
run: | | |
set -e | |
curl -sSL https://install.python-poetry.org | python3 - | |
version=$(git describe --tags --abbrev=7) | |
sed -i "s/version = \"0.0.0\"/version = \"${version:1}\"/" pyproject.toml | |
echo "__version__ = '${version:1}'" > ./hadoop_fs_wrapper/_version.py | |
- name: Configure Test PyPi | |
if: ${{ github.ref == 'refs/heads/main' }} | |
env: | |
PYPI_TEST_TOKEN: ${{ secrets.PYPI_TEST_API_TOKEN }} | |
run: | | |
set -e | |
poetry config repositories.test-pypi https://test.pypi.org/legacy/ | |
poetry config pypi-token.test-pypi $PYPI_TEST_TOKEN | |
- name: Publish distribution 📦 to test PyPI | |
if: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
set -e | |
poetry build && poetry publish -r test-pypi | |
- name: Publish distribution 📦 to PyPI | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} | |
if: ${{ startsWith(github.ref, 'refs/tags') }} | |
run: | | |
set -e | |
poetry build && poetry publish |