Skip to content

🔧 docs: update README to enhance installation instructions and add do… #1604

🔧 docs: update README to enhance installation instructions and add do…

🔧 docs: update README to enhance installation instructions and add do… #1604

Workflow file for this run

name: Build and Package with Poetry (Feature)
on:
push:
branches:
- 'releases/**'
jobs:
build-and-publish-python-package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Run image
uses: abatilo/actions-poetry@v4
with:
poetry-version: "1.5.1"
- name: Increment version
id: version
run: |
BRANCH_NAME=$(echo $GITHUB_REF | sed 's/refs\/heads\///')
VERSION=$(poetry version --short)
MINOR_PATCH_PART=${VERSION#*.}
LAST_VERSION_PART_PREFIX=${MINOR_PATCH_PART%??}
PATCH_PART=${LAST_VERSION_PART_PREFIX%.*}
if [[ $BRANCH_NAME == "fix"* || $BRANCH_NAME == "bugs"* ]]; then
NEW_LATEST_PATCH_PART=$((PATCH_PART+1))b${GITHUB_RUN_ID}
elif [[ $BRANCH_NAME == "feature"* ]]; then
NEW_LATEST_PATCH_PART=$((PATCH_PART+1))a${GITHUB_RUN_ID}
elif [[ $BRANCH_NAME == "test"* ]]; then
NEW_LATEST_PATCH_PART=$((PATCH_PART+1))rc${GITHUB_RUN_ID}
elif [[ $BRANCH_NAME == "main"* || $BRANCH_NAME == "releases"* ]]; then
poetry version patch
VERSION=$(poetry version --short)
MINOR_PATCH_PART=${VERSION#*.}
LAST_VERSION_PART_PREFIX=${MINOR_PATCH_PART%??}
PATCH_PART=${LAST_VERSION_PART_PREFIX%.*}
NEW_LATEST_PATCH_PART=${PATCH_PART}${GITHUB_RUN_ID}
else
echo "Invalid branch name"
exit 1
fi
NEW_VERSION=${VERSION%.*}.${NEW_LATEST_PATCH_PART}
echo $NEW_VERSION
echo "::set-output name=version::$NEW_VERSION"
echo "::set-output name=versionType::Release"
poetry version $NEW_VERSION --no-ansi
- name: Install dependencies
run: poetry install
- name: Test with pytest
run: |
poetry run pytest
- name: Build Package
run: |
poetry build
- name: Publish a Python distribution to PyPI
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }}
poetry publish
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.KODEXA_GITHUB_TOKEN }}
with:
tag_name: v${{ steps.version.outputs.version }}
release_name: Release v${{ steps.version.outputs.version }}
draft: false
prerelease: false