Skip to content

fixes installation in windows (#435) #7

fixes installation in windows (#435)

fixes installation in windows (#435) #7

Workflow file for this run

name: Release workflow
on:
push:
branches:
- master
paths:
- pyproject.toml
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "poetry"
- name: Check version change
id: version_check
run: |
git fetch origin master --depth=2
PREV_VERSION=$(git show origin/master~1:pyproject.toml | grep '^version' | cut -d '"' -f2)
CURR_VERSION=$(grep '^version' pyproject.toml | cut -d '"' -f2)
echo "Previous version: $PREV_VERSION"
echo "Current version: $CURR_VERSION"
echo "version=$CURR_VERSION" >> $GITHUB_OUTPUT
if [ "$PREV_VERSION" = "$CURR_VERSION" ]; then
echo "Version unchanged. Skipping release."
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi
- name: Install Poetry
run: |
pip install poetry
- name: Install dependencies
run: |
poetry install --no-interaction --no-root
- name: Build package
if: steps.version_check.outputs.changed == 'true'
run: |
poetry build
- name: List build artifacts
if: steps.version_check.outputs.changed == 'true'
run: |
ls -lh dist/
- name: Publish to PyPI
if: steps.version_check.outputs.changed == 'true'
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.POETRY_PYPI_TOKEN_PYPI }}
run: |
poetry publish --no-interaction
- name: Create git tag
if: steps.version_check.outputs.changed == 'true'
run: |
VERSION=v${{ steps.version_check.outputs.version }}
git config user.name "github-actions"
git config user.email "github-actions@github.com"
if git rev-parse "$VERSION" >/dev/null 2>&1; then
echo "Tag already exists. Skipping."
else
git tag -a "$VERSION" -m "Release $VERSION"
git push origin "$VERSION"
fi
- name: Create GitHub Release
if: steps.version_check.outputs.changed == 'true'
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ steps.version_check.outputs.version }}
name: v${{ steps.version_check.outputs.version }}
generate_release_notes: true